Running code from in second access database

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
 
N

Naresh Nichani MVP

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top