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

  • Thread starter Thread starter M Skabialka
  • Start date Start date
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
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top