Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I am trying to write a macro that opens another Access Database

Status
Not open for further replies.

CMoriarty

Technical User
Mar 21, 2003
10
US
I am trying to write a macro that opens another Access Database, launches a macro within that database, and then close the second database when it's macro is done. I know this could not be done in Access 97, but can be done in 2000. In a nutshell, I am attempting to create a macro that...

1)Exports a table from mdb1 to another folder where mdb2 resides (I know how to do this).
2)Opens mdb2 and launches a macro on mdb2 (all behind the scences w/o the user seeing it).
3) When the macro on mdb2 has finished, the mdb2 closes and reactivates mdb1.


I haven't learned code or VB, so bear in mind that I am a newbie.....

Any help would be GREATLY appreciated!!!!
 
Although this isn't a macro, I have been using this code in Access97 to switch between databases. I am not sure what modifications would be needed for it to run in 2000. Another option is to use a free add in "TSI SOON" from Trigeminal Software at
I haven't tried TSI SOON yet, but they say it works in both Access97 and 2000.

Here is the code I used in 97 to switch databases:

Private Sub cmdCreateUsers_Click()
'Open user queries database
DoCmd.Hourglass True
Dim objAccess As Access.Application
Dim lngRet As Long
Set objAccess = New Access.Application
lngRet = apiSetForegroundWindow(objAccess.hWndAccessApp)
lngRet = apiShowWindow(objAccess.hWndAccessApp, SW_NORMAL)
'the first call to ShowWindow doesn't seem to do anything
lngRet = apiShowWindow(objAccess.hWndAccessApp, SW_MAXIMIZE)
objAccess.OpenCurrentDatabase "L:\Access8\IMDownCombo.mdb"

DoCmd.Hourglass False
DoCmd.Quit
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top