Query that make table in another database

  • Thread starter Thread starter Boon
  • Start date Start date
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
 
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
 
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
 
Back
Top