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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Queries from another database

Status
Not open for further replies.

Tamrak

MIS
Jan 18, 2001
213
US
Good morning,

This might be a simple question. Is it possible to link the queries from another database, without having to import them?

I created a query from Database A, which links to the almost the same tables that Database B has. However, there is only one field that I really want obtain the result from a query in Database B. This query was a result from several other queries generated.

I can do the hard part, which is to link and match all tables similar to Database B and import several queries into Database A.

Is this the only solution that I can do? I am concerning that I might have another database, such as Database C. Then, I have to import several queries the same way. Please comment regarding the most efficient method to do this. Thank you.
 
1. It is somewhat difficult to understand your question. Perhaps English is not your native language. Is this an accurate way to restate your question??

_________________________________________

I can use file/get external data/import to open another .mdb and import a query.
I can use file/get external data/link tables to open another .mdb and link to a table in that .mdb.
How do I do a *link* to a select query in another .mdb?

_________________________________________

If that is your question, I think that I know the answer. You cannot link to a query in another .mdb using the gui. However, you could use vba to get a recordset from another database, and then interact with it. That recordset could come from a select query in the other .mdb.
 
OhioSteve,

Thank you for your reply. Let me elaborate the question for you.

I am working with a database. Let's call Database B. I created queries based on tables.

By working with this Database, I cannot obtain a desired result. I remember that we created queries from another database, let's call Database A. All I need is just one field in one query from Database A. However, this query was the result from several queries generated on the top of each other.

The hard part to do is to create everything similar to Database A. Link all the tables and import all related queries from Database A into Database B.

Then, I can link or set relationship with my current query to the query imported from Database A, in order to obtain the result.

My question are, is this the only way that I can do? Are there other sufficient ways to do it? Can I link the queries from one DB to another DB without having to import them?

I hope I am clear. Let me know if I am not.



 
Okay, I think I understand now. You are saying you want to reuse queries from a.mdb in b.mdb. In fact, you may want to reuse these queries in other .mdbs in the future. And if you improve these queries, you want them to change in every .mdb. Is that your goal?

I don't think you can achieve that goal using just the gui. You would need to rely heavily on vba.
 
OhioSteve,

Thank you for your reply.

That is correct.

The painpul thing is that, the query generated in a.mdb came from the results of several queries on the top of many queries. All I need is just one field from that query.

When I created b.mdb, I recalled that I could obtain one field from the query resided in a.mdb. However, this means I have to copy all related queries plus create the links to several tables.

That will be my last resort, if I have to do it.

My question is simple. Are there anyway to make it more efficient by linking the queries between the mdb files, in order to obtain the desired results?

Thank you.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top