Access Importing Access Tables using VB / SQL

Joined
Jun 14, 2005
Messages
2
Reaction score
0
Hello to all experts out there,
I am seriously stuck due to the beauty of Microsoft Access....
I encountered a problem creating tables with sql and then importing data from csv files using TransferText. Everything works fine except for one field, which I defined as text (in the sql create statement) but in which the csv files contain all kinds of alphanumeric strings. The entries which are not purely numeric are simply not imported (the fileds remain empty). I also tried to define that specific field as char and varchar in the sql statement, but the problem was not solved. Does anybody have an idea??
Part of my code is as follows:

Tablename = "Lim" ' varying table names
sqlCreate = "CREATE TABLE " & Tablename & "today" & "(A Long,B Text,C Text,D Text);"
DoCmd.RunSQL sqlCreate
DoCmd.TransferText acImportDelim, , _
Tablename & "today", CSVFileName, True


where my csv file looks something like this:

A; B; C; D;;
1000009; Kat; C1; mcs;;
1000009; Fld; K500;mcs;
1000009; KuGru; 8; mcs;

Problem does not occur while importing other csv files or in other fields of the current csv , besides column C. Though defined as text, only the numeric expressions are imported. So my table looks the almost the same, only that in column C, I get empty entries instead of "C1" and K500" and only the numeric expressions like "8" are imported properly. I am new to VB and SQL so I would appreciate simple suggestions.
Thanks in advance
 
Joined
Jun 11, 2005
Messages
28
Reaction score
1
hmicky said:
......
Problem does not occur while importing other csv files or in other fields of the current csv , besides column C. Though defined as text, only the numeric expressions are imported. So my table looks the almost the same, only that in column C, I get empty entries instead of "C1" and K500" and only the numeric expressions like "8" are imported properly. I am new to VB and SQL so I would appreciate simple suggestions.
Thanks in advance

Hi,

You can try to put the strings between qoutes.
example:
A; B; C; D;
1000009;"Kat";" C1";" mcs";
1000009;"Fld"; "K500";"mcs";
1000009;"KuGru";" 8";" mcs";

I hope that the tip was usefull
 
Joined
Jun 14, 2005
Messages
2
Reaction score
0
unfotunately it does not help, the alphanumeric values are simply not imported. Thanks fir the reply
 

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