473,320 Members | 1,744 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Run a MS Access Subroutine from VB.Net

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?

Nov 21 '05 #1
4 3324
On Tue, 9 Aug 2005 05:16:02 -0700, "Mark" <Ma**@discussions.microsoft.com> wrote:

¤ 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)
Nov 21 '05 #2
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

"Paul Clement" wrote:
On Tue, 9 Aug 2005 05:16:02 -0700, "Mark" <Ma**@discussions.microsoft.com> wrote:

¤ 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)

Nov 21 '05 #3
On Tue, 9 Aug 2005 09:56:10 -0700, "Mark" <Ma**@discussions.microsoft.com> wrote:

¤ 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)
Nov 21 '05 #4
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

Nov 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Marco Alting | last post by:
Hi, I'm still confused about my queries, I want to do something is ASP that is easily done in Access. I'll post the Access queries below as a reference. The main idea is that the queries depend...
2
by: Blake Patterson | last post by:
I have a subroutine I want to run whenever an Access record is updated. Sub Form_BeforeUpdate(Cancel As Integer) Me!LastUpdated = Now End Sub It updates this date field with the current date...
6
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much...
16
by: cyranoVR | last post by:
This is the approach I used to automate printing of Microsoft Access reports to PDF format i.e. unattended and without annoying "Save As..." dialogs, and - more importantly - without having to use...
3
by: Mads Petersen | last post by:
I'm stuck in this code. Hope you can and will help me. I launch it from excel. I have made the following code work, but not as i whant. I need the ranges to be working with something like xlDown....
7
by: Ariel | last post by:
I have a question that I'm hoping someone here can answer. Let's say I have two fields which have a beginning number and an ending number. What I'd like to do is have Access generate a list of...
55
by: AnandaSim | last post by:
I just had a google through this NG but have not seen mention of Erik Rucker's blog entry and the new Jet: http://blogs.msdn.com/access/archive/2005/10/05/477549.aspx mentioned by Mike...
2
by: chuck.streb | last post by:
On a button event, I call a VB subroutine. The subroutine takes some time, it is importing from excel. I have a progressbar that works while the subroutine is looping. Before the loop I write...
0
by: Gabriel Genellina | last post by:
En Wed, 19 Nov 2008 20:06:37 -0200, Yann Vonder <yann.vonderscher@gmail.comescribió: If you put tmod in both libraries, you'll have two copies of it, and two copies of the data. Can't you join...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.