How to run macro from another database?

sunakothi

New member
Local time
Today, 20:22
Joined
Oct 28, 2010
Messages
2
Hi,
I've desinged two database one for queries and another for report ( coz data was too big). I'm trying to open only report dbase, because most of the data from queries database after running all queries from the queries dbase.What i have done was trying to open only 1 dbase (report) run queries at the queries dbase. followling VB code I have tired.

Dim AppAccess As Object
' Create instance of Access Application object.
Set AppAccess = CreateObject("Access.Application")
'Open Service Desk KPI Metrics Queries.mdb database in Microsoft Access window.
AppAcsess.OpenCurrentDatabase "C:\Documents and Settings\ricop.dongol\My Documents\Service Desk KPI Metrics Queries.mdb", False
'False so as not to open in exclusive mode
AppAccess.Run "KPI1"
AppAccess.DoCmd.Minimize

Set AppAccess = Nothing


MsgBox "Done!"

after run command I received error msg object required?

ANy help from you guys!!!
 
The problem is that you are referring to the wrong minimize. If you want the app minimized you would need:

Code:
AppAccess.DoCmd.RunCommand acCmdAppMinimize
 
But the question is - why do you want it to minimize because you blow it away in the next line with setting it to nothing.
 
Hi Bob,

reason I put minimize command so when run the command it will not appears at the screen. I 've tried without minimize command still error msg "object required".
any other Idea!!

thanks for you help.
 
A couple of things -

1. By having the code to set AppAccess = Nothing I believe that you are not even letting it have time to do the macro. I could be wrong but that's how it appears.

2. Also, when you say it gives you an Object Required error, what line does it stop on when it gives you that?
 

Users who are viewing this thread

Back
Top Bottom