Page 1 of 1

Relative Path to Access mdb

Posted: Sun 06 Jan 2013 21:00
by FriedhelmDrecktrah
Hi,
how can I set a relative Path in UniConnection.Database for an Access mdb Database file?
E.g. UniConnection.Database:= 'data\MyDb.mdb' does not work.
It only works if I set an absolute path on my development machine, but this path
does not exist on the client computer :-(

Thanks and greetings
Friedhelm Drecktrah

Re: Relative Path to Access mdb

Posted: Tue 08 Jan 2013 14:20
by AlexP
Hello,

MS Access ODBC driver doesn't support relative paths, therefore you should generate a full path. For example, if the DB file is located in a ..\data\ folder relatively to your application, you can use the following code to generate the path:

UniConnection1.Database := ExtractFilePath(Application.ExeName) + 'data\MyDb.mdb';

Re: Relative Path to Access mdb

Posted: Tue 08 Jan 2013 16:10
by FriedhelmDrecktrah
Hi,
good idea, thank you!

Greetings
Friedhelm