Relative path in database query connection string

D

DanL

I have a connection string that starts out like this:

DSN=Excel Files;DBQ=C:\Folder1\Folder2\Folder3\Filename.xls;

This is an absolute path, but I would like to use a relative path (i.e.
...\Filename.xls without the preceding path) instead. Is this possible?

In this case I am actually using this connection string within the
Filename.xls file. So what I would REALLY like is for the connection string
to refer to the path of the file that is using it. This way, if I save a
copy of the file Filename.xls as Filename2.xls, I don't have to change the
connection string and it will automatically point to Filename2.xls.
 
J

Joel

The connection string is a String that you can modfiy like any string (DUH!)

from
Connection = "DSN=Excel Files;DBQ=C:\Folder1\Folder2\Folder3\Filename.xls;"

to
Folder = "C;\Temp\"
Connection = "DSN=Excel Files;DBQ=" & Folder & "Filename.xls;"
 

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