Click to See Complete Forum and Search --> : Retrieve Application Path
nandini
December 29th, 1999, 02:01 PM
Hi Gentle folks,
In MSAccess from the menu items I have set the "default directory" as C:\my documents. My database application is in C:\project. In my application I have to write data to a text file which has to be stored in C:\project. "curdir" returns C:\my documents. Is there any other function or method that can be used to retrieve the path of the database application.
Thanx in advance .... Nandini
BrewGuru99
December 29th, 1999, 04:39 PM
I had a very similar problem a while back. Without going back into my code, I beleive I ended up using CurrentDB.Name
Brewguru99
tarandhingra
December 29th, 1999, 11:21 PM
u can use app.path function
nandini
December 30th, 1999, 09:54 AM
The project is in MS Access. VB supports app.path, while VBA doesn't support app.path. Any further help on this would be appreciated.
Thanks
Nandini
tarandhingra
December 31st, 1999, 05:18 AM
you can use CurDir() function
if you want teh return value as variant type then use this function as it is but if you want to return the value as string type then use $ sign with it
like CurDir$()
This example uses the CurDir function to return the current path.
' In Microsoft Windows:
' Assume current path on C drive is "C:\WINDOWS\SYSTEM".
' Assume current path on D drive is "D:\EXCEL".
' Assume C is the current drive.
Dim MyPath
MyPath = CurDir ' Returns "C:\WINDOWS\SYSTEM".
MyPath = CurDir("C") ' Returns "C:\WINDOWS\SYSTEM".
MyPath = CurDir("D") ' Returns "D:\EXCEL".
' on the Macintosh:
' Drive letters are ignored. Path for current drive is returned.
' Assume current path on HD Drive is "HD:MY FOLDER".
' Assume HD is the current drive. Drive MD also exists on the machine.
Dim MyPath
MyPath = CurDir ' Returns "HD:MY FOLDER".
MyPath = CurDir("HD") ' Returns "HD:MY FOLDER".
MyPath = CurDir("MD") ' Returns "HD:MY FOLDER".
you can check MS Access help for this.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.