How to import file using a relative file path.

  • Thread starter Thread starter Steve
  • Start date Start date
S

Steve

I'm building a database that will need to be moved to
other drives in the future. When I define the file paths
for my macros to import data, I have to gave a drive
letter, with will change later.

Question: How do I give a path to, say, the a file in the
subfolder under the root directory in which the DB
resides, without having to define the drive letter?

Thanks.
 
Determine where the DB resides using

Left(CurrentDb.Name, Len(CurrentDb.Name) - Len(Dir(CurrentDb.Name)))
or
CurrentProject.Path

and build up the actual file location from that.
 
Back
Top