Import File Location(s): Check for File Existance

M

MJ

I am sure that someone out there has come across this situation and has a
good solution, thank you for your tima and assistance in advance.

I have several databases which import files from network and ftp locations,
but the problem is that I am not the only persone using these locations and
from time to time other users will move files to other locations (archive,
etc...) in order to "clean-up" the folder.

So this leaves me with a choice of doing this manually or coming up with a
process to:
1) Check in a "primary location";
2) If not there, check in a "secondary location";
3) If not there, check in a "...ary location"; or
4) "Gracefully" tell the user that the file has not been found and exit
the process.
a) Another option to exiting the process might be to allow the user
to select another import location.

Structurally this could easily be a If then-Else If-Else. Just wondering if
any of you have a well defined process/procedure for checking for an import
file through coding?

Thanks again for the help.
 
D

Douglas J. Steele

An easy way to check whether a file exists is to use the Dir function: if
you pass it a full path to a file, it'll return a zero-length string if the
file doesn't exist. However, using Dir can cause problems if you're inside a
loop that relies on the Dir function. A "safer" approach is the API method
Randy Birch demonstrates in
http://vbnet.mvps.org/code/fileapi/fileexists.htm
 

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

Top