VBA to parse date from file name

I want to prevent an ACCESS 2003 module or macro from sending our reports  IF I do not see a file in a network folder dated with the current date in the name.    For example every day a file is sent to a folder named.... file_[current date].   A scheduled task picks up the file,  imports into ACCESS 2003 and sends report out via OUTLOOK.  In the module I need to write an IF ELSE statement.  IF the file with the current date is NOT in the folder the module should stop and/or send a message to the developer to say the file is not there.  ELSE IF the file with the current date IS in the network folder I want the module to import the data and generate the reports.  

Thoughts?  THANKS ALL
eyes59Asked:
Who is Participating?
 
SharathConnect With a Mentor Data EngineerCommented:
pseudo code would be like this.
FileNameDatePart = REPLACE(FileName,'file_','')
If (DATEDIFF(d,FileNameDatePart,DATE()) = 0 Then
	Do something
else
	Do something
end if

Open in new window

0
 
NorieVBA ExpertCommented:
Which folder is it and how will the date be formatted if it's there?
0
 
eyes59Author Commented:
Thank You
0
 
NorieVBA ExpertCommented:
I must have misread, I thought you needed code to check if the file is in a particular directory
0
All Courses

From novice to tech pro — start learning today.