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
 
Top