user2276280
user2276280

Reputation: 601

Importing query results from another database

So I have two Access databases, let's call them myDatabase and anotherDatabase. In anotherDatabase there is a crosstab query. I want to get the results that this query produces into myDatabase without making ANY modifications to anotherDatabase or the query itself. I want myDatabase to be enitrely self-sufficient in the sense that the databases it interacts with will not have to be modified.

Could anyone give me advice on how to approach this?

Upvotes: 1

Views: 3039

Answers (2)

iDevlop
iDevlop

Reputation: 25272

Linking external tables is limited to external tables and won't allow you to get data from queries in another db.
One solution for external queries is to create a local query using the IN predicate:

SELECT * FROM myQuery IN 'c:\test\otherdb.mdb' 

Upvotes: 2

Scotch
Scotch

Reputation: 3226

Use the Linked Table Manager to link the tables in anotherDatabase to myDatabase. Then you can have the query for anotherDatabase in myDatabase and just use that.

In the External Data tab (in myDatabase), click the button that says Import From Access. Except, instead of importing the table, click the radio button that says "Link to the data source by creating a linked table". Just follow the wizard and you should be all set.

You only need to link the tables that you require from your query. Another option would be to write some vba code in myDatabase that instantiates a connection to anotherDatabase and queries it, but I think that just linking the tables is a better solution with less hassle

Upvotes: 1

Related Questions