DataDirectory doesn't seem to work in VBA

T

Tony Polizzi

Hello,

I usually connect to an MS Access Database from my Word XP (first edition)
document with the following connection string and it works fine:

cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\Documents and Settings\Tony
Polizzi\Desktop\MyDataBase\MyDataBase.mdb"

For obvious portability reasons now, I need to use a neutral connection
string in order to avoid to change the code of the connection string every
time. I tryed this but it seems it doesn't work:

cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=|DataDirectory|\MyDataBase.mdb"

Any idea about easily solving this matter?

Thanks in advance
Tony Polizzi
 

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