Need function to tell whether a certain file exists in a named folder

M

M Skabialka

I have a database that tracks filename and folder of many documents.
Sometimes users delete them or move them.

Is there a function that can tell you whether a certain file exists in a
named folder, so I can move through the table and remove references to docs
that aren't therre any more?

e.g. \\fileserver\contracts\IBM\purchaserequest03Jan05.doc

Thanks,
Mich
 
D

Dirk Goldgar

M Skabialka said:
I have a database that tracks filename and folder of many documents.
Sometimes users delete them or move them.

Is there a function that can tell you whether a certain file exists
in a named folder, so I can move through the table and remove
references to docs that aren't therre any more?

e.g. \\fileserver\contracts\IBM\purchaserequest03Jan05.doc

Thanks,
Mich

Have you tried the Dir() function? If it returns a zero-length string,
then the file doesn't exist:

If Len(Dir("\\fileserver\contracts\IBM\purchaserequest03Jan05.doc"))
= 0 Then
' the file isn't there
End If

Bear in mind, though, that if you give it an invalid server name, error
52 will be raised -- you'll want to trap for that error.
 
Top