C
Chris via AccessMonster.com
I have deployed an app in the app is a form that imports all files in a directory. Stores the files as tables with the tablename as the filename. Works great! I would like to take this one step further in that certain files contain different variations of a larger group for example a group is EB33. My function now would import the file and I would have a table name EB33.
In that file can contain two different variables of that call them EB33A and EB33b. Right now I would have to eventually create a seperate table for each. I would like to make two tables from that one import EB33A and "B". Meanwhile I still have mutliple files to import. Here is the code I am currently using for importing all files.
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
Dim tblName As String
ChDir ("c:\Email_Promo\Lists")
strfile = Dir("*.csv")
Do While Len(strfile) > 0
'table name same as file name without ext
tblName = Left(strfile, (InStr(1, strfile, ".") - 1))
DoCmd.TransferText acImportDelim, "ImportFiles", tblName, strfile, True
strfile = Dir
Loop
End Sub
In that file can contain two different variables of that call them EB33A and EB33b. Right now I would have to eventually create a seperate table for each. I would like to make two tables from that one import EB33A and "B". Meanwhile I still have mutliple files to import. Here is the code I am currently using for importing all files.
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
Dim tblName As String
ChDir ("c:\Email_Promo\Lists")
strfile = Dir("*.csv")
Do While Len(strfile) > 0
'table name same as file name without ext
tblName = Left(strfile, (InStr(1, strfile, ".") - 1))
DoCmd.TransferText acImportDelim, "ImportFiles", tblName, strfile, True
strfile = Dir
Loop
End Sub