Access Programmer - Orlando Gonzalez

Wednesday, November 02, 2005

Call an Access Database Procedure from another Access Database

Here is an Access VBA example of how to call an external Access Database VBA procedure from within a different access database.

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

2 Comments:

  • This works pretty good.. Thanks for posting!

    By Anonymous Anonymous, At 12:34 PM  

  • I used your script to call the external procedure however the mdb app window in the second app keeps poping up. i have used echo +false; have hidden the second app database window etc...hovere it keeps poping up. Any way to hide the second app window while the procedure is finishing

    By Blogger bentley, At 1:36 PM  

Post a Comment

Subscribe to Post Comments [Atom]



<< Home