ACC: Cannot Open a Database with a DoMenuItem MacroID: Q103187
|
Moderate: Requires basic macro, coding, and interoperability skills.
When you try to open another database with a macro containing DoMenuItem
(RunCommand in Access 97) and Sendkeys actions, the macro does not seem to
run.
Microsoft Access cannot open another database while the DoMenuItem action is running in the current database. Microsoft Access does not support opening multiple databases.
To work around this behavior, use either of the following methods. The
first method runs a macro from the Database window. The second method runs
a macro from a button on a form.
The resolution for Microsoft Access 97 involves the OpenCurrentDatabase
method. Do not confuse the OpenCurrentDatabase method with the DAO
OpenDatabase method.
For more information about the OpenCurrentDatabase method and an example of
its use, search the Help Index for "OpenCurrentDatabase method," or ask the
Microsoft Access 97 Office Assistant.
Macro Name Action
------------------------
OpenMDB SendKeys
OpenMDB Actions
---------------------------------
SendKeys
Keystrokes: %fo<YOURFILE>.MDB~
Wait: No
Macro Name Action
-----------------------------
OpenMDB2 SelectObject
SendKeys
OpenMDB2 Actions
---------------------------------
SelectObject
Object Type: Macro
Object Name: OpenMDB2
In Database Window: Yes
SendKeys
Keystrokes: %fo<YOURFILE>.MDB~
Wait: No
Name: Button1
Caption: Open Database
Macro Name Action
-----------------------
OpenMe SendKeys
DoMenuItem
OpenMe Actions
---------------------------------------------------------
SendKeys
NORTHWIND.MDB~ (or NWIND.MDB in versions 1.x and 2.0)
DoMenuItem
Menubar: Database
Menu Name: File
Command: Open database
Macro Name Action
-----------------------
OpenMe SendKeys
RunCommand
OpenMe Actions
---------------------------------------------------------
SendKeys
NORTHWIND.MDB~ (or NWIND.MDB in versions 1.x and 2.0)
RunCommand
Command: OpenDatabase
Additional query words: opendb
Keywords : kbusage McrArg
Version : 1.0 1.1 2.0 7.0
Platform : WINDOWS
Issue type : kbprb
Last Reviewed: March 26, 1999