Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Connection Obect for Two Paths
I have a server that contains a database and a workbook.
The workbook code uses ADO to connect to the database, run a query and return the results to the worksheet. 'Where cn is my ADODB.Connection "cn.Open "Driver={Microsoft Access Driver (*.mdb)};Dbq=C:\DatabasePath\DatabaseName.mdb;" This works fine. On another computer, I have a folder that is shared to that folder on the server. I want to open the same workbook from this shared folder and run the code. I'd need to modify the statement to something like this: 'Where cn is my ADODB.Connection and V is the mapped drive letter to DatabasePath. "cn.Open "Driver={Microsoft Access Driver (*.mdb)};Dbq=V:\DatabaseName.mdb;" The problem is I'd like to have my code detect the path to the database (depending from where I'm opening the workbook) and set up the string accordingly. Any suggestions? tod |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Connection Obect for Two Paths
Use this instead... will work no matter what machine your on.
\\databaseserver\databasepath\databasename.mdb Dennis "Tod" wrote in message ... I have a server that contains a database and a workbook. The workbook code uses ADO to connect to the database, run a query and return the results to the worksheet. 'Where cn is my ADODB.Connection "cn.Open "Driver={Microsoft Access Driver (*.mdb)};Dbq=C:\DatabasePath\DatabaseName.mdb;" This works fine. On another computer, I have a folder that is shared to that folder on the server. I want to open the same workbook from this shared folder and run the code. I'd need to modify the statement to something like this: 'Where cn is my ADODB.Connection and V is the mapped drive letter to DatabasePath. "cn.Open "Driver={Microsoft Access Driver (*.mdb)};Dbq=V:\DatabaseName.mdb;" The problem is I'd like to have my code detect the path to the database (depending from where I'm opening the workbook) and set up the string accordingly. Any suggestions? tod |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
always recheck data connection library for latest connection strin | Excel Discussion (Misc queries) | |||
Paths | New Users to Excel | |||
I hate paths! | Excel Discussion (Misc queries) | |||
Help with filenames and paths. | Excel Discussion (Misc queries) | |||
file paths | Excel Discussion (Misc queries) |