To check if a File Exist

  • Thread starter Thread starter Vina
  • Start date Start date
V

Vina

I have a form with a command button to import a file and
delete it but if the file doesnt exist it causes an error.
Can someone help me what function or code can i use to
check if that file exist in the folder and if so then run
the import and delete or else not.

Thanks
Vina
 
Vina said:
I have a form with a command button to import a file and
delete it but if the file doesnt exist it causes an error.
Can someone help me what function or code can i use to
check if that file exist in the folder and if so then run
the import and delete or else not.

If Dir("PathToFile") = "" Then
'The File Doesn't Exist
Else
'The File Exists
End If
 
Back
Top