tags:

views:

1005

answers:

1

I have a tab-delimited text file and want to import it in MS Access using VBA code.

I have created an MS Access form and have used the DoCmd.TransferText method:

DoCmd.TransferText(TransferType, SpecificationName, TableName, FileName, HasFieldNames, HTMLTableName, CodePage)

It works well for CSV File. I'm not sure how to do it in case of tab-delimited text files.

Any suggestions?

+2  A: 

Do a manual import, changing the delimiter to TAB, save the import spec, and then specify that import spec in your TransferText command.

David-W-Fenton
Thanks David. I mport has been done, the Issue left is how to do error Handling.. means if on Button Click, user selectes a file (Different text file of diffrent format) then how do it pops a msg and tell usr to select proper file... is there anything to do.. I will be highly thanful for urhelp
Ashok Gupta
I use Windows API to call the Windows file open dialog: http://mvps.org/access/api/api0001.htm . As to error handling, a standard VBA error handler in the OnClick event of your command button should to the job just fine.
David-W-Fenton