IF Stmt To Check For Presence of Files Before Executing A Marco

C

Cindy Lovell

Is there a way to make a conditional macro where the
condition is based on presence of files? The macro I want
to execute has transfer text file commands and then
executes some queries. I don't want to run this macro, if
the text files do not exist. I need to create another
macro that has a condition to check for the presence of
the files - if found, execute the other macro, if not
found then end.

Thanks for your help!
Cindy
 
S

Steve Schapel

Cindy,

Use this syntax in your macro Condition...
Len(Dir("C:\YourPath\YourFile.txt"))>0

- Steve Schapel, Microsoft Access MVP
 
C

Cindy Lovell

Thanks Steve. That worked great!

Cindy
-----Original Message-----
Cindy,

Use this syntax in your macro Condition...
Len(Dir("C:\YourPath\YourFile.txt"))>0

- Steve Schapel, Microsoft Access MVP




.
 

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