File Import Question

kebert111

New member
Local time
Today, 17:26
Joined
Nov 2, 2006
Messages
3
I am using the following VB Code to import a file into Access. The problem is that if we run this on Monday, the file we are trying to import in from Friday (and therefore is not Date - 1). Do you know how I would go about importing Friday's file?

DoCmd.TransferText acImportDelim, "Test Import Specification", "test file", "C:\Test_" & Format(Date - 1, "yyyymmdd") & ".txt", True, ""

Thanks.
 
You need to know what day you are doing the import.

Try the following to convert the current date to yield the current day:

=Format(Date(),"dddd").

If your day yields Monday, then you just need to subtract 3 from
your date to get Friday's date, otherwise, subtract 1 to get the prior
day's date (which is what you have now). This assumes your original
code works -- I have not tested it.
 

Users who are viewing this thread

Back
Top Bottom