?
Solved

VBA to parse date from file name

Posted on 2013-10-25
4
Medium Priority
?
427 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 41

Accepted Solution

by:
Sharath earned 2000 total points
ID: 39600850
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 34

Expert Comment

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

Author Closing Comment

by:eyes59
ID: 39600870
Thank You
0
 
LVL 34

Expert Comment

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

Featured Post

Percona Live Europe 2017 | Sep 25 - 27, 2017

The Percona Live Open Source Database Conference Europe 2017 is the premier event for the diverse and active European open source database community, as well as businesses that develop and use open source database software.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

User Beware!  This is a rather permanent solution to removing your email from an exchange server.  The only way to truly go back is to have your exchange administrator restore your mailbox from backups.  This is usually the option of last resort.  A…
This collection of functions covers all the normal rounding methods of just about any numeric value.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
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…

765 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