Data type issue when importing from excel to access

L

Lin

I tried to import a csv file to access using trsnfetext method. My code is
working fine, however, because of data type mismatch some data not importing.
I have a 'customer#' column which contains numbers only and alphanumeric
numbers. The appending table's field 'Customer#' is text. But when importing
it iis not importing aiphanumeric customer number to the field. How can I fix
this issue using VBA.

Any help, really appreciated.
 
K

Ken Snell

You need to use an import specification (second argument of the
DoCmd.TransferText method). In that specification, set the data type of this
particular field to Text.

You create an import specification by manually beginning the import process
(via File | Export). When you're in the wizard window, click the Advanced
button at bottom left. In the new window, you'll see all the settings you
can specify. Enter all the information. Click Save As button and save them
as a specification (name it whatever you want, e.g., "MyEImportSpec", for
example). Click OK button to return to the main window of the wizard. Then
click Cancel button to cancel the rest of the import.

Now go to your TransferText code and add the name of the specification to
the appopriate argument position.
 

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