How to import file using a relative file path.

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.
 
D

Douglas J. Steele

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.
 

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