Import Text File with Import Spec

D

dball

I have a large fixed width txt file with a lot of fields. I have the file
layout as an excel worksheet. The file does not have field names.

I want to be able to create the table using the layout excel spreadsheet.

I can't figure out how to turn the spreadsheet into an import spec.

Please help.

Thanks
Dave
 
P

Piet Linden

I have a large fixed width txt file with a lot of fields.  I have the file
layout as an excel worksheet.  The file does not have field names.

I want to be able to create the table using the layout excel spreadsheet.

I can't figure out how to turn the spreadsheet into an import spec.

Please help.

Thanks
Dave

You want to create a table from a text file with no field names? Bad
plan, IMHO. Create the table, then use an import specification to put
the data into the appropriate columns...

Public Sub ImportFixedWidth(ByVal strFile As String)

DoCmd.TransferText acImportFixed, "ImportSpecName",
"DestinationTable", strFileName, False
End Sub
 
D

dball

no, I want to use the layout to create the table structure and then import
the data. I take it was you suggest is how to do the above.

I will try it and see if I can figure it out.

Thanks
 
P

Piet Linden

no, I want to use the layout to create the table structure and then import
the data.  I take it was you suggest is how to do the above.  

I will try it and see if I can figure it out.

Thanks

The problem with creating the table structure on the fly is that you
can't reuse queries etc, because your structures will change. That's
why I didn't think it was a great idea... just seems like a lot more
work than necessary.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top