Passing a date variable to import file

  • Thread starter Thread starter margo430
  • Start date Start date
M

margo430

Hi, I'm new to ms access 2000 and require help. I have three files -
A,B,C which are produced daily; each of these files have a date in the
name - meaning file A is A-12152005.txt; B-12152005.txt and
C-12152005.txt. I would like to create a macro that would import these
three files once a day and load a table. Can any one help me?
 
Margo,

Use 3 TransferText actions in your macro, one for each of the 3 files.
In the File Name argument, you can do like this for example...
="C:\YourFolder\A-" & Format(Date(),"mmddyyyy" & ".txt"
 
Steve, thank you. I've tried your suggestion but was not successful.
I've removed '=' since it would not work with them. Now I get an error
which stated 'data set needs to be a TXT' etc. I've put a closing
), but that still didn't work.
 
Include closing parenthesis --
="C:\YourFolder\A-" & Format(Date(),"mmddyyyy") & ".txt"
-- OR --
="C:\YourFolder\A-" & Str(Format(Date(),"mmddyyyy")) & ".txt"
 
Margo,

I apologise for the typo in my post. As you have detected, I missed out
a ) and the expression should ber like this...
="C:\YourFolder\A-" & Format(Date(),"mmddyyyy") & ".txt"
Does this work? If not, can you post back with a copy/paste of the
exact expression you have used, and also what actually happens, e.g.
error message.
 
Back
Top