String/date concatenation?

J

John Davis

Hi all,

I'm trying to write a function that will look for a
specific text file and, if present, import it into
Access. I want to use this function as part of a
scheduled macro. I know how to check for the presence of
a file, but my problem is how to write the code that will
recognize the file name.

Specifically, my files are genereated daily in the format
of:
REPORTING_20031130.TXT
REPORTING_20031201.TXT
etc

I don't know how to write the code to have the function
automatically check to see if the file has today's date on
it in the specified format.

Any suggestions?

Thanks in advance!
 
K

Ken Snell

Dir("C:\MyFolder\REPORTING_" & Format(Date(), "yyyymmdd") & ".TXT") <> ""

The above condition will be true if the file exists; false if it doesn't.
 

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