importing variable filenames

  • Thread starter Thread starter Rich
  • Start date Start date
R

Rich

I'm trying to automate daily file uploads that change
according to the dates attached to the backend of a
standard filename...
ie, "position_20030910.csv". I would like to import the
file "position_%".

thanks
 
Here is one idea.

How to Import all Files in a Folder:

Private Sub btnImportAllFiles_Click()
'procedure to import all files in a directory and delete them.
'assumes they are all the correct format for an ASCII delimited import.
Dim strfile As String

ChDir ("c:\MyFiles")
strfile = Dir("FileName*.*")
Do While Len(strfile) > 0
DoCmd.TransferText acImportDelim, "ImportSpecName", "AccessTableName",
"c:\MyFiles\" & strfile, True
'delete the file (consider moving it to an Archive folder instead.)
Kill "c:\MyFiles\" & strfile
strfile = Dir
Loop

End Sub
 
Back
Top