How to get current application path?

B

Birk Binnard

The TransferText command requires passing the full path and filename of
the TXT file to be imported. My users put the text file in the same
folder as the Access application itself. But how do I get the path name
of that folder?

The CurDir function does not do it. That function seems to return either
the computer's default path or the path to My Documents, neither of
which is what I need. The Access application is located on a mapped
network server drive and I have currenrtly hard coded the path into the
TransferText parameter string. But if teh drive mappings change I'm in
trouble.

I thought the Application object would have the proper path in it
somewhere, but I can't find anything like that there. Is there
someplace else I shoudl look?
 
D

Dirk Goldgar

Birk Binnard said:
The TransferText command requires passing the full path and filename
of the TXT file to be imported. My users put the text file in the
same folder as the Access application itself. But how do I get the
path name of that folder?

The CurDir function does not do it. That function seems to return
either the computer's default path or the path to My Documents,
neither of which is what I need. The Access application is located
on a mapped network server drive and I have currenrtly hard coded the
path into the TransferText parameter string. But if teh drive
mappings change I'm in trouble.

I thought the Application object would have the proper path in it
somewhere, but I can't find anything like that there. Is there
someplace else I shoudl look?

In Access 2000 or later, use

CurrentProject.Path

In Access 97, you have to extract it from CurrentDb.Name .
 

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