Hello All.
I have many text table files needed to be imported to the database, while the user would specify which text file table to import.
I created a VBA function with a parameter, which is for the text table file name. It doesn't work however:
I get the following error:
Run-time error '3011'
The Microsoft Jet database engine could not find the object 'tblNewTable'. Make sure the object exists and that you spell its name and path name correctly.
My problem here is, that I can't create a table beforehand because each text table file has different field names and different number of them.
Using a macro does the job, without requiring a table to created before hand:
Action: TransferText
Transfer Type: Import Delimited
Specification Name:
Table Name: tblNewTable
File Name: C:\Organization1.csv
Has Field Names: Yes
HTML Table Name:
Code Page:
But in macro I can't use a parameter in File Name field.
How can I do the job using VBA?
Please help.
Thanks,
inso18.
I have many text table files needed to be imported to the database, while the user would specify which text file table to import.
I created a VBA function with a parameter, which is for the text table file name. It doesn't work however:
Code:
Function ImportTextTable(strFileName)
DoCmd.TransferText acExportDelim, , "tblNewTable", strFileName, True
End Function
Run-time error '3011'
The Microsoft Jet database engine could not find the object 'tblNewTable'. Make sure the object exists and that you spell its name and path name correctly.
My problem here is, that I can't create a table beforehand because each text table file has different field names and different number of them.
Using a macro does the job, without requiring a table to created before hand:
Action: TransferText
Transfer Type: Import Delimited
Specification Name:
Table Name: tblNewTable
File Name: C:\Organization1.csv
Has Field Names: Yes
HTML Table Name:
Code Page:
But in macro I can't use a parameter in File Name field.
How can I do the job using VBA?
Please help.
Thanks,
inso18.