Current Application Folder

S

Sunny

I want to to store application folder into variable. My application is
c:\MyApplication folder
In Immidiate window I tried following code:
cCurDir = CurDir
?cCurDir returns
C:\Documents and Settings\userii\My Documents
I was expecting c:\MyApplication! How do I get expected result?

Thanks.
 
B

Bruce M. Thompson

I want to to store application folder into variable. My application is
c:\MyApplication folder
In Immidiate window I tried following code:
cCurDir = CurDir
?cCurDir returns
C:\Documents and Settings\userii\My Documents
I was expecting c:\MyApplication! How do I get expected result?

You didn't say which version of Access you were using, but the following method
will work in all versions (watch for line wrap - it's all on one line):

cCurDir = Left(CurrentDb.Name, len(CurrentDb.Name)-len(dir(CurrentDb.Name)))

In Access 2000 and later, you can use:

cCurDir = CurrentProject.Path
 
S

Sunny

Thanks Bruce. Sorry forgot to include version, its 2002. CurrentProject.Path
works fine. Once again thanks.
 

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