PC Review


Reply
Thread Tools Rate Thread

Data type issue when importing from excel to access

 
 
Lin
Guest
Posts: n/a
 
      29th Jan 2010
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.
 
Reply With Quote
 
 
 
 
Ken Snell
Guest
Posts: n/a
 
      29th Jan 2010
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.

--

Ken Snell
http://www.accessmvp.com/KDSnell/



"Lin" <(E-Mail Removed)> wrote in message
news:6BA8B147-B5C8-417D-9E68-(E-Mail Removed)...
>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.



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem Importing records with Date/Time data type into an Access 2007 data table Cillacil Microsoft Access External Data 0 3rd Apr 2009 08:50 PM
VBA Import Convert Data Type from Type 1 to Type 2 u473 Microsoft Excel Programming 3 21st Oct 2008 08:22 PM
importing exel data - defining data type in access fields mitja decman Microsoft Access External Data 1 10th Aug 2005 02:25 PM
Importing Excel spreadsheet into Access - data type problem Andrew Good Microsoft Access External Data 3 27th Aug 2004 10:21 AM
Importing Excel spreadsheet into Access - data type problem Andrew Good Microsoft Access 2 27th Aug 2004 09:39 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:21 AM.