Link to a query??

S

Scott

Hello, Is it possible to Link to a query in another database??

I would like to create a button in my database where I can lookup some
information in another database based on a value in a field of the db I
am in. This would be easy if I could just link to the table however the
info I want is in a query and not a table. Is there a way to link to a
query???

Alternatively is there another perhaps easier way to do this? basically
just need to LOOKUP field values from another db based on a fields value
of the current db

TIA
 
W

Wayne Morgan

I don't see a way, but you can link to the table(s) in the other database
and import the query into your database.
 
S

Scott

Thanks for the response. Problem is the query is base on that table and a
couple other large ones, so that would involve me linking, importing a number
of large tables which doesnt serve me well.

Would there be another way of just using code and DLOOKUP to retrieve the info
from the other db???
 
W

Wayne Morgan

Linking won't "import" the data from the other database, it lets you access
it but leaves it in the other database. Since the work is being done by the
query on your end, yes a lot of data will be transfered when the query is
run. There are ways to attach to the other database file using code, but as
far as I know, the result will be the same. The problem is that it is just a
file at the other end. There is no application there to do the work, so the
data has to be pulled across to do the work on your end. To handle the query
at the back-end would require something like SQL server to take your
request, do the processing, and send you just the results.
 
T

Timothy Ford MCSD MCP

You could programatically create a pass-through query with
the parameter from your current db built from a dynamic
string variable. After the pass-through query is built
then you can call that query as though it is local. See
Microsoft KB article #304323 for how to create the
function that creates a pt query. One of the params is a
string variable that will be the SQL text of the pt
query. When building that variable do so with the local
value you want as part of the query and it should work
just fine - I use this all the time.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top