![]() |
Run a MS Access Procedure from Excel
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 Access.Application acApp = CreateObject("Access.Application") acApp.Application.Visible = True acApp.OpenCurrentDatabase("C:\myDirectory\myDB.mdb ", True) acApp.Application.Run("myModule.mySub") 'Error on this line mySub is defined as a Public sub. Suggestions? Thanks, Mark |
Run a MS Access Procedure from Excel
Mark,
Try... Set acApp = CreateObject("Access.Application") Jim Cone San Francisco, USA "Mark" wrote in message ... 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 Access.Application acApp = CreateObject("Access.Application") acApp.Application.Visible = True acApp.OpenCurrentDatabase("C:\myDirectory\myDB.mdb ", True) acApp.Application.Run("myModule.mySub") 'Error on this line mySub is defined as a Public sub. Suggestions? Thanks, Mark |
Run a MS Access Procedure from Excel
Made change and it still bombs out. It dies on the acApp.Application.Run line of code. Thanks, Mark "Jim Cone" wrote: Mark, Try... Set acApp = CreateObject("Access.Application") Jim Cone San Francisco, USA |
Run a MS Access Procedure from Excel
Mark,
Try your code using only your acApp qualifier and make sure you have a reference set to the Access library in Tools | references in Excel. Dim acApp As Access.Application Set acApp = CreateObject("Access.Application") acApp.Visible = True acApp.OpenCurrentDatabase("C:\myDirectory\myDB.mdb ", True) 'I am unfamiliar with Access syntax, so some experimentation is in order. 'Note: no () used... acApp.Run "myModule.mySub" or acApp.Run "mySub" or acApp.Run "myDB.mdb.myModule.mySub" Jim Cone San Francisco, USA "Mark" wrote in message ... Made change and it still bombs out. It dies on the acApp.Application.Run line of code. Thanks, Mark "Jim Cone" wrote: Mark, Try... Set acApp = CreateObject("Access.Application") Jim Cone San Francisco, USA |
Run a MS Access Procedure from Excel
Jim - 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 |
All times are GMT +1. The time now is 02:13 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com