D
Deleted member 147267
Guest
If that comment was meant for me...No - I understand it exactly as you reiterated it. That's what my suggestion was about.I think you are looking at this in the wrong way.
If that comment was meant for me...No - I understand it exactly as you reiterated it. That's what my suggestion was about.I think you are looking at this in the wrong way.
If that comment was meant for me...No - I understand it exactly as you reiterated it. That's what my suggestion was about.
Hello Gasman,
unfortunately I get the same error message:
Run-Time error 2517
Procedure Test couldn't be found by Microsoft Access.
I'm getting desparate, shouldn't be so difficult to open another database and run a program![]()
Call Countables(appcess)
Public Countables (app as Access.Database)
Taking from GasMan's example, Here is what the code should look like when you run it from a single database.
Code:Sub TestSubInAnotherDB() Dim appAccess As Access.Application Dim strFileName As String Dim strDBFolder As String strDBFolder = "c:\test\db\" 'change the path accordingly strFileName = Dir(strDBFolder) Do While strFileName <> "" If strFileName Like "*.MDB" Then 'Or *.ACCDB 'Create instance of Access Application object. Set appAccess = CreateObject("Access.Application") 'Open Test Database in Microsoft Access window. appAccess.OpenCurrentDatabase strFileName, False 'Run Sub procedure. appAccess.Run "CountTables" Set appAccess = Nothing End IF Loop End Sub
Hi Gasman,
unfortunately it didn't work out.
I can run the procedure with Application.Run on the same database, but it doesn't apply the code on the other database.
Gettin desperate here
***************
Hi. Not sure I understand what you're trying to do, but I tried a little experiment. Please download the attached file and extract its contents into a Trusted Folder. Open DB1 and make sure you can execute the function in it called Test(), which merely opens a Message Box. Close DB and try the same thing with DB2. What DB2 does is basically execute the Test() function in DB1. In my tests, the message box opens up behind the window I had for DB2, so you may have to use the Taskbar to find it. I didn't create any form to execute the code. I just used the Immediate Window. Is this what you mean?Thank you so far.
Let me describe my issue.
I got a database with a procedure I want to run in another database.
It still doesn't work. I don't know the issue. I'm using Access 2013,maybe that's the issue???
Can I open a table in the new opened database, as a simple test?
Thank you.
Hi Ben. I knew I could be thinking of it backwards. So, can you post the code you want to execute against the other databases or at least give us an idea what you're trying to do? Maybe we can come up with another way to do it. Cheers!I've checked the databases provided by thedbGuy, thanks for this.
But the code is stored under the new opened database db1.
I have the code in the original database and want to execute this program in the new opened database. Can I copy the sub module to the new database?
Regards,
Ben
Hi Ben. Congratulations! Glad to hear you got it sorted out. Good luck with your project.Thank you all for the help.
I've found a hot fix.
The sub is copied to the new opened database, runs it there and deleted after the run.
Now it works.
Thank you.
Kind regards,
Ben