Solved

VBA to parse date from file name

Posted on 2013-10-25
4
421 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 500 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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

I wanted to share this with fellow Experts, who might not know. How often have you wanted to learn something, only to be set back by either restrictions imposed on "trial" or "evaluation" software?  How often have you had to rebuild a home networ…
The System Center Operations Manager 2012, known as SCOM, is a part of the Microsoft system center product that provides the user with infrastructure monitoring and application performance monitoring. SCOM monitors:   Windows or UNIX/LinuxNetwo…
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
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…

737 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