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

Connection String In Excel

Status
Not open for further replies.

mfosterla

Programmer
Apr 10, 2008
7
US
I have an Excel workbook and Access Database that are going to be moved around a lot but always in the same directory. I have a Database Connection String in the Excel workbook as follows:

DSN=MS Access Database;
DBQ=C:\Databases\MCD.mdb;
DefaultDir=C:\Databases;
DriverId=25;
FIL=MS Access;
MaxBufferSize=2048;
PageTimeout=5;

I want to set DBQ and DefaultDir to be the current workbook path. I know I can use ThisWorkbook.Path using VBA. But, How can I accomplish this in the Connection String under conection properties?

Thanks,

Mark Foster
 
If you change the DBQ line to this, it might work...
Code:
DBQ=CurrentProject.Path & "\MCD.mdb"
 
That would work in vb but the setting is in the connections properties dialog box in ms query
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top