Verify Path/Directory

  • Thread starter Thread starter Dan B
  • Start date Start date
D

Dan B

Hi;

This should be a really easy one (I hope).

I have a string called strPathDirFile. In it, I have the
Path/Directory and filename of my back-end database.
What does the code look like that checks for the back-end
database being present? Do I actually have to try to
open the backend and check for error codes? How?

Thanks,
Dan
 
Dan,

If Dir(strPathFile, vbNormal) <> "" Then
MsgBox "The file exists!"
End If

You can get the backend path from the linked tables' Connect property:
Dim strBackendPath As String

strBackendPath = CurrentDb.TableDefs("a linked table").Connect
strBackendPath = Mid(strBackendPath, Instr(1, strBackendPath, "=") + 1)

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
Thanks Graham
-----Original Message-----
Dan,

If Dir(strPathFile, vbNormal) <> "" Then
MsgBox "The file exists!"
End If

You can get the backend path from the linked tables' Connect property:
Dim strBackendPath As String

strBackendPath = CurrentDb.TableDefs("a linked table").Connect
strBackendPath = Mid(strBackendPath, Instr(1, strBackendPath, "=") + 1)

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia




.
 
Back
Top