Test For The Existence Of A File

DALIEN51

Registered User.
Local time
Today, 22:45
Joined
Feb 26, 2004
Messages
77
If i hold a record in a table with the path and file name held in one field, is it possible to code Access 2000 to check that this file exists? I want the database to perform a certain action should it not be found.

Any help most appreciated.

Many thanks
 
Try this code,courtesy of the Dev Ashish site.

'***************** Code Start *******************
'This code was originally written by Dev Ashish
'It is not to be altered or distributed,
'except as part of an application.
'You are free to use it in any application,
'provided the copyright notice is left unchanged.
'
'Code Courtesy of
'Dev Ashish
'
Function fIsFileDIR(stPath As String, _
Optional lngType As Long) _
As Integer
'Fully qualify stPath
'To check for a file
' ?fIsFileDIR("c:\winnt\win.ini")
'To check for a Dir
' ?fIsFileDir("c:\msoffice",vbdirectory)
'
On Error Resume Next
fIsFileDIR = Len(Dir(stPath, lngType)) > 0
End Function
'***************** Code End *********************
 
Searching the forum is a great way to discover and learn the answers to your Access programming questions.

check if file exists
 

Users who are viewing this thread

Back
Top Bottom