Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to call a query located in another database?

Status
Not open for further replies.

jsteven

Programmer
Jun 2, 2000
4
US
I have two databases. The first has the data and the query. The second needs the results of the query. I want to call the query from the second database. How do I call the query in the first database from the second database? Note: I tried copying the query to the second database and make links to the tables, but I am not getting the right results with the copy of the query.
 
you can Import the query in your database from the other database.<br>Or you can Link the Tables in the other database to your database then import the query. <p>DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br> Ask me how Bar-codes can help you be more productive.
 
Thanks for your response. I have tried that, but I don't get the right numbers. Is there a way to call or execute a query that is in another database?
 
You can use OpenDatabase, then refer to that db's querydefs collection:<br>Dim DBREM As Database, QD As QueryDef<br>Set DBREM = DBEngine(0).OpenDatabase(&quot;C:\Infoware\CFAC\cfac97.mdb&quot;)<br>Set QD = DBREM.QueryDefs(&quot;QUERY1&quot;)<br>QD.Execute<br>--Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top