Re: Checking if a file exists



Public Function FileExists(ByVal filespec As String) As Boolean
On Error Resume Next
FileExists = (GetAttr(filespec) And vbDirectory) = vbNormal
End Function

Public Function DriveExists(ByVal DriveSpec As String) As Boolean
On Error Resume Next
DriveExists = Len(CurDir$(DriveSpec)) > 0
End Function

Public Function FolderExists(ByVal FolderSpec As String) As Boolean
On Error Resume Next
FolderExists = (GetAttr(FolderSpec) And vbDirectory) = vbDirectory
End Function

--
Chris Hanscom - Microsoft MVP (VB)
Veign's Resource Center
http://www.veign.com/vrc_main.asp
Veign's Blog
http://www.veign.com/blog
--


"Nick" <nicholas_jp@xxxxxxxxxxxx> wrote in message
news:1140998289.815052.268120@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi everyone,
Is there a way VB6 can test for the existance of a specific data file?
Thanks,
Nick



.



Relevant Pages

  • Re: Incorporating optional function argument
    ... If, for instance, you had MsgBox =Test or Debug.Print Test there would be something for the user to observe. ... Public Function test(strMsg As String, Optional blnVal As Boolean = False) ... A break point at the Public Function line does not result in the code breaking. ...
    (microsoft.public.access.formscoding)
  • Re: Incorporating optional function argument
    ... Public Function test(strMsg As String, Optional blnVal As Boolean = False) ... If I put this into the event property, ...
    (microsoft.public.access.formscoding)
  • Re: Command button to open form and find record
    ... Opens the form if it is not already open. ... Public Function OpenFormTo(strForm As String, strWhere As String, Optional bGotoNewRecord As Boolean, _ ... Optional strOpenArgs As String) As Boolean ... Public Function HasProperty ...
    (microsoft.public.access.forms)
  • Re: Incorporating optional function argument
    ... For now I have added the optional argument to the event property function calls. ... Public Function test(strMsg As String, Optional blnVal As Boolean = False) ...
    (microsoft.public.access.formscoding)
  • Re: How to tell if a form is open?
    ... > Public Function FrmIsLoaded(frm As String) As Boolean ... > Set prj = Application.CurrentProject ...
    (comp.databases.ms-access)