Insert into query doesn't write all fields

G

Guest

I have this SQL statement which I use to write a CSV file to a database table
from a Word macro:

strSQL = "INSERT INTO [" & strTable & "] " & _
"SELECT * " & _
"FROM [Text;HDR=YES;DATABASE=" & strPath & ";].[" & strWkFile_DB
& "]"

I don't get any errors but there are some fields that don't write to the
table. Here is a sample row from the CSV file, preceded by the header row:

Contact_Name1, Property_Street, Property_City, Property_ST, Property_ZIP,
Lead_ID, List_Date, Contact_Phone1, Contact_City1, Price, Our_Source
Current Resident, 344 S 1015 W, Orem, UT, 84058, 699353, 06/14/2007, , ,
$269000, MLS_07_0626



Any thoughts? Should I delimit the fields in a different way? Thanks in
advance.
 
C

Carl Rapson

muybn said:
I have this SQL statement which I use to write a CSV file to a database
table
from a Word macro:

strSQL = "INSERT INTO [" & strTable & "] " & _
"SELECT * " & _
"FROM [Text;HDR=YES;DATABASE=" & strPath & ";].[" &
strWkFile_DB
& "]"

I don't get any errors but there are some fields that don't write to the
table. Here is a sample row from the CSV file, preceded by the header row:

Contact_Name1, Property_Street, Property_City, Property_ST, Property_ZIP,
Lead_ID, List_Date, Contact_Phone1, Contact_City1, Price, Our_Source
Current Resident, 344 S 1015 W, Orem, UT, 84058, 699353, 06/14/2007, , ,
$269000, MLS_07_0626



Any thoughts? Should I delimit the fields in a different way? Thanks in
advance.

Which fields don't write to the table? Have you noticed any pattern in which
fields are having problems? Are all of the fields that do write to the table
written correctly?

Also, have you tried using DoCmd.TransferText to import your CSV file?

Carl Rapson
 
Top