Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 989
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default 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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 989
Default 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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default 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


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 989
Default 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





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Stop a Procedure from another procedure Ayo Excel Discussion (Misc queries) 1 October 30th 08 01:42 AM
Calling a procedure in a procedure Norman Jones Excel Programming 8 August 20th 04 07:53 PM
Calling a procedure in a procedure N10 Excel Programming 2 August 18th 04 12:49 AM
Calling a procedure in a procedure Don Guillett[_4_] Excel Programming 1 August 17th 04 11:31 PM


All times are GMT +1. The time now is 10:26 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"