Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 439
  • Last Modified:

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
0
eyes59
Asked:
eyes59
  • 2
1 Solution
 
SharathData 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
 
NorieCommented:
Which folder is it and how will the date be formatted if it's there?
0
 
eyes59Author Commented:
Thank You
0
 
NorieCommented:
I must have misread, I thought you needed code to check if the file is in a particular directory
0

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now