Running code from in second access database

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi All

I have two separate access databases (we wish to keep them separate) and wish to do the following
- automatically run code in DB
- code in DB1 then opens DB2 while still keeping DB1 ope
- run code in DB
- close DB
- close DB
How do I open DB2 and run code in it from within code in DB1
Help greatly appreciate
Titus
 
Hi:

You could try this code like this --

Dim objAccess as Access.APplication
Set objAccess = new Access.Application
objAccess.OpenCurrentDatabase "DB2 Fullpath"
objAccess.DoCmd.RunMacro "MacroNameToRun"
objAccess.Quit

Regards,

Naresh Nichani
Microsoft Access MVP
 
Back
Top