Solved

VBA to parse date from file name

Posted on 2013-10-25
4
411 Views
Last Modified: 2013-10-25
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
Comment
Question by:eyes59
  • 2
4 Comments
 
LVL 40

Accepted Solution

by:
Sharath earned 500 total points
Comment Utility
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
 
LVL 33

Expert Comment

by:Norie
Comment Utility
Which folder is it and how will the date be formatted if it's there?
0
 

Author Closing Comment

by:eyes59
Comment Utility
Thank You
0
 
LVL 33

Expert Comment

by:Norie
Comment Utility
I must have misread, I thought you needed code to check if the file is in a particular directory
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

The canonical version of this article is on my web site here: http://iconoun.com/articles/collisions/ A companion presentation is available here: http://iconoun.com/articles/collisions/Unicode_Presentation.pdf
Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now