Yes, Demi, Sendkeys is always a last resort.
Stuffing keystrokes into the keyboard buffer is a crude, brute-force
approach. The keystrokes go to the active window, whichever that is. In a
multi-tasking environment, you don't know that the window you expect will
have focus when the program runs, and who knows what it might do if some
other window gets focus.
There is a bug in Access, where SendKeys messes up the state of NumLock as
well.
In early versions of Access, Microsoft introduced DoMenuItem as a way to
programmatically initiate an item from a menu. The arguments are zero-based,
so acEditMenu has the value 1 (the 2nd menu), and 10 represents the 11th
item on the menu. But the menu items changed in the different versions of
Access, and people customized their menus. As a result, MS standardized this
to the menu bar items that were present in Access 95 (i.e. version 7.0.) So:
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70
actually means:
Activate the 11th item from the Edit menu of the Form menubar,
whatever that was on the original Access 95 menu structure.
If that sounds arcane to you, I guess it did to Microsoft as well, so, in
Access 97, they introduced RunCommand as a safer and more reabable way of
getting at the menu items (and a bunch of other things too.) RunCommand is
therefore the preferred approach. There are even cases where RunCommand
works while DoMenuItem does not (e.g. some actions in popup forms, where the
Access menus themselves are not available.)
However, Microsoft never got around to re-writting all the wizard code that
used DoMenuItem. To this day, the wizards are still creating arcane code.
That's a real shame, because many users learn to code by seeing what the
wizards do, even though the wizard code is sometimes the worse possible
choice. And they made it difficult for people to learn to use RunCommand,
because there is no real list explaining what the 500+ constants actually
to. To my knowledge, the best list is this old one from Terry Wickenden:
http://www.tkwickenden.clara.net/