[AccessD] DIR Command Failing-but not everywhere...

Gustav Brock Gustav at cactus.dk
Mon Oct 3 12:08:38 CDT 2005


Hi all

You can use a simple API function for exactly this:

Private Declare Function PathIsDirectory Lib "shlwapi.dll" Alias "PathIsDirectoryA" ( _
  ByVal pszPath As String) _
  As Long

Public Function IsDir( _
  ByVal strPath As String) _
  As Boolean
  
' Returns True if strPath exists.
  
  Dim stzPath As String
  
  stzPath = strPath & vbNullChar
  
  IsDir = CBool(PathIsDirectory(stzPath))

End Function

/gustav

>>> Lambert.Heenan at AIG.com 03-10-2005 18:44 >>>
Will I suppose you could trap error 52, which seems to only happen with
Dir() when you access a drive with no disk in it. If the error happens it's
a safe bet to interpret it as "Drive Empty" and issue an appropriate message
to the user.





More information about the AccessD mailing list