To find out current directory?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I need to find out from which drive and directory my Acces-application (not
Access itself) was started from. How will that look like in VBA?
Another questions is how I can find out, with VBA, if a file exists at a
certain location.

Any help is appreciated!

Access 2002
 
To get the name and directory of the database Use db.name

If you do not how to get this:

dim db as Database
set db = currentdb()
debug.print db.name


To test for a file try:

Open *file path/name* for input as #1

If you receive an error, the file does not exist!


Hope this helps,
Fred.
 
1.
Try

CurrentProject.Path
======================
2.
Dim strPath As String
strPath = "c:\FileName.doc"
If Dir(strPath) = "" Then
MsgBox "Can't find file"
Else
....
End If
 
Back
Top