Access - Import data from .txt in a path relative to the .accdb
Posted on 2014-09-22
I have an Access 2013 database (I didn't write it, but given the task of updating) that uses a macro to import data from txt files in another directory. The macro is hard coded with the drive letter so I converted it to VB, and would like to change it to use a relative path to make it more portable and usable for others that may already have the drive letter in use (like me). Is this possible? I've done some searching on the net, but haven't really found anything that tells me one way or the other.
It's an Access 2013 front end (.accdb) linked to a SQL 2012 db.
The paths it's currently configured to use are:
Database path: Y:\dept\db\FrontEnd\PCName\DB.accdb
Import file location: Y:\Dept\db\FileTransfer\Data\InputFile.txt
I was hoping to use a ..\.. shortcut statement in the path to the import file, but nothing I've tried seems to be working. Admittedly, I'm very new to DB design and VB scripting.