Run a MS Access Subroutine from Excel

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm trying to execute a Subroutine located within the an Access database.
But I get the error "Microsoft Access can't find the procedure
'ModuleName.mySub' " when the "acApp.Application.Run" statement is executed.

Dim acApp As Access.Application
Set acApp = CreateObject("Access.Application")
acApp.Application.Visible = True
acApp.OpenCurrentDatabase "C:\Access DB\myDB.mdb", True
acApp.Application.Run ("'ModuleName.mySub")

mySub is declared as Public.

Any suggestions?

Thanks, Mark
 
Mark said:
I'm trying to execute a Subroutine located within the an Access database.
But I get the error "Microsoft Access can't find the procedure
'ModuleName.mySub' " when the "acApp.Application.Run" statement is executed.

Dim acApp As Access.Application
Set acApp = CreateObject("Access.Application")
acApp.Application.Visible = True
acApp.OpenCurrentDatabase "C:\Access DB\myDB.mdb", True
acApp.Application.Run ("'ModuleName.mySub")

mySub is declared as Public.


Maybe it's just a typo, but you have an extraneous
apostrophe in there. Also, drop the parenthesis.
 
Back
Top