application path

  • Thread starter Thread starter Dave
  • Start date Start date
D

Dave

Hi,
I have written some error handling code that wites details of the error to a
log file.

I want to be able to use this in a numbe of my projects now.
So instead of hardcoding the path of the log in the code id like to have it
be dynamic.

ie

apppath/appname_errorlog.txt

I cant find the variable that hold the applications path.
Any suggestions appreciated

Thanks

Dave
 
Thanks for reading but i've found i can use this

varFileName = Left(Application.CurrentDb.Name,
Len(Application.CurrentDb.Name) - 4) & "_ErrorLog.txt"

and it seems to work ok for me
 
In recent versions of Access, you can use CurrentProject.Path,
CurrentProject.Name, and CurrentProject.FullName. But your method is fine
too, and has the advantage that it will also work with earlier versions of
Access.
 
Back
Top