Execute a VBA Module from VB.Net

M

Mark

From VB.Net, I want to open an Access database and run VBA module that
resides in the Access database. .Net gives me the error message that Access
can't find the VBA Module.

'StartCode

Dim appAccess as Access.Application
Dim strProc as String = "RunTest.myProc"

appAccess = CreateObject (Access.Application)
appAccess.OpenCurrentDatabase("C:\Documents and Settings\My
Documents\DB.mdb", False)
appAccess.Visible = True

'This is the problem statement:
AppAccess.Run(strProc)
'.Net gives me the error message: "Microsoft Access can't find the procedure
'RunTest.myProc.'." - For some reason there is an extra "." after myProc
which I don't know why its there

appAccess.Quit
appAccess = Nothing

'End Code

Thank you for your help
Mark
 
D

Douglas J. Steele

Try eliminating the parentheses around strProc in your call:

appAccess.Run strProc
 

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