Run a MS Access Subroutine from VB.Net

G

Guest

I want to execute a subroutine in MS Access database. But I get an error that
"Microsoft Access can't find the procedure 'myModule.mySub.' "

Dim acApp As Microsoft.Office.Interop.Access.Application
acApp = CreateObject("Access.Application")
acApp.Application.Visible = True
acApp.OpenCurrentDatabase("C:\myDirectory\myDB.mdb", True)
acApp.Application.Run("myModule.mySub")

mySub is defined as a Public sub.

Suggestions?
 
P

Paul Clement

¤ I want to execute a subroutine in MS Access database. But I get an error that
¤ "Microsoft Access can't find the procedure 'myModule.mySub.' "
¤
¤ Dim acApp As Microsoft.Office.Interop.Access.Application
¤ acApp = CreateObject("Access.Application")
¤ acApp.Application.Visible = True
¤ acApp.OpenCurrentDatabase("C:\myDirectory\myDB.mdb", True)
¤ acApp.Application.Run("myModule.mySub")
¤
¤ mySub is defined as a Public sub.

I don't believe that you specify the module name.


Paul
~~~~
Microsoft MVP (Visual Basic)
 
G

Guest

Unfortunately, it still bugged out on me after I got rid of the module name.

Thanks for the idea. Do you have any others?

Mark
 
P

Paul Clement

¤ Unfortunately, it still bugged out on me after I got rid of the module name.
¤
¤ Thanks for the idea. Do you have any others?
¤

I don't see any problems with the syntax. Have you tried doing a Debug...Compile from the Microsoft
Access code editor?


Paul
~~~~
Microsoft MVP (Visual Basic)
 
G

Guest

Paul - Thanks for the comments.

And the problem was:
The module name and the procedure name were the same!!!
Once the procedures name was changed, the code
' acApp.run "newSubname" ' worked great.

Only lost a half a day on it!

Mark
 

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