Running VBA in one DB from another DB

G

Greystad

Hello,

Overtime, I have created 3 Access DB (each with separate uses and information)
which require updating. I have also written VBA behind a button in each DB
which to automate the update procedure.

I instead of having to open 3 DB each time I would like to be able to start
the update processes for the 3 different DB from one DB. Is this possible?

Kathy
 
D

Daniel Pineault

You could create a macro that run your update code and then simply invoke it
by using Access' command line switched. See

http://support.microsoft.com/kb/105128

or you could use a sub similar to what I have provided below. I got it from
this forum a while back (don't know the original author)

Sub ForeignProcedure()

Dim appAccess As Access.Application

' Create instance of Access Application object.
Set appAccess = CreateObject("Access.Application")

' Open MyDatabaseName.mdb database in Microsoft Access window.
appAccess.OpenCurrentDatabase “C:\MyDatabaseName", False
'False so as not to open in exclusive mode
' Run Sub procedure.
appAccess.Run "ForeignProcedureName"
appAccess.Quit
Set appAccess = Nothing

MsgBox "Done!"

End Sub
--
Hope this helps,

Daniel Pineault
For Access Tips and Examples: http://www.cardaconsultants.com/en/msaccess.php
If this post was helpful, please rate it by using the vote buttons.
 

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