Current Application Folder

  • Thread starter Thread starter Sunny
  • Start date Start date
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.
 
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
 
Thanks Bruce. Sorry forgot to include version, its 2002. CurrentProject.Path
works fine. Once again thanks.
 
Back
Top