Import CSV with wildcard?

option

Registered User.
Local time
Today, 11:16
Joined
Jul 3, 2008
Messages
143
Hey guys,

I'm trying to import a series of .csv files into a table in my database daily. The only issue I'm having (so far!) is that my file names change daily, and it'd be pretty silly to go in and change the code everyday just to run the process. My file name would be something like "20090224_option.csv", which is todays date_my name. The date AND the name are going to change based on when the file was created and who created it. I have appx 35-40 csv files to import daily, all created by a different user, so my wildcard would obviously be the user name. Is there any way to acomplish this in VBA? Here is my code so far:

Code:
Private Sub Inser()
Dim Dest As String
Dim fiPat As String

Dest = "tblMainStorage"
fiPat = "C:\importme\20090224_*.csv"

DoCmd.TransferText acImportDelim, "", "tblMainStorage", fiPat, True, ""
End Sub
 
Last edited:
Here is another example that uses filters and extensions
 

Attachments

Users who are viewing this thread

Back
Top Bottom