Solved

VBA to parse date from file name

Posted on 2013-10-25
4
420 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
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 33

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 33

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MMC can't display 1 48
Make sub to format and total ranges 9 66
Guide for enabling bit locker encryption within Windows 10 Pro 3 123
VBA name newly created sheet 4 32
We were having a lot of "Heartbeat Alerts" in our SCOM environment, now "Heartbeat" in a SCOM environment for those of you who might not be familiar with SCOM is a packet of data sent from the agent to the management server on a regular basis, basic…
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…
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
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…

830 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