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 sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to call Access VBA from VB? 1

Status
Not open for further replies.

valdosta

MIS
Dec 18, 2002
50
US
Hi, I want to use VB app to call VBA module in an Access database. Can someone please help? Thanks in advance!
 
This is done via automation. You need to 1) declare a variable defined as Access.Application and 2) include the VBA library for the version of Access you're using in the Project References. This is the same one that shows in Access when you look at the References.

Dim AppAccess as Access.Application
...
Set AppAccess = New Access.Application

Then you need to open the Access database the same way that you would in VBA and call the routine in your module. The routine must be Public.

As soon as the database is open, the normal Access window will open, unless you minimize it. Be sure to close the database (AppAccess.Quit) when you're done.

 
Thank you, jiqjaq, for pointing to the right direction. I finally made it work.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top