Query that make table in another database

B

Boon

Hi,

I have two databases in directory C:\Projects\

In my make table query, I put the destination as C:\Projects\Database2.mdb

How can I make it independent of the path? i.e. I want to be able to run the
query even if the two databases are in C:\data\admin\Golive\....

Thanks,
B
 
M

Marshall Barton

Boon said:
I have two databases in directory C:\Projects\

In my make table query, I put the destination as C:\Projects\Database2.mdb

How can I make it independent of the path? i.e. I want to be able to run the
query even if the two databases are in C:\data\admin\Golive\....


You can use this kind of thing in a VBA procedure that
constructs the query.

Dim SQL As String
SQL = "SELECT ... INTO thetablename _
IN """ & CurrentProject.Path & "\Database2.mdb"" "
CurrentDb.Execute SQL
 
J

John Spencer MVP

IF you want this independent of the path, you are going to have to build the
SQL string using VBA and then execute the query string. You cannot do it using
a saved query.

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 

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