arsenal042004
Technical User
I currently use this small bit of code to import text files into a table as batch. I'd like to know if there is a way to also import in a field, the file name. Since I have many files and I need to know where certain records come from.
Thanks in advance for your assistance!
Todd
Private Sub Command0_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 ("D:\New")
strfile = Dir("D:\CNew\*.csv")
Do While Len(strfile) > 0
DoCmd.TransferText acImportDelim, "EVAL", "EVAL", "D:\CNew\" & strfile, True
'delete the file (consider moving it to an Archive folder instead.)
Kill "D:\CNew\" & strfile
strfile = Dir
Loop
End Sub
Thanks in advance for your assistance!
Todd
Private Sub Command0_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 ("D:\New")
strfile = Dir("D:\CNew\*.csv")
Do While Len(strfile) > 0
DoCmd.TransferText acImportDelim, "EVAL", "EVAL", "D:\CNew\" & strfile, True
'delete the file (consider moving it to an Archive folder instead.)
Kill "D:\CNew\" & strfile
strfile = Dir
Loop
End Sub