syntax error in string in query expression '45') (1 Viewer)

bndck

New member
Local time
Today, 01:38
Joined
Jan 20, 2011
Messages
1
[FONT=Verdana, Arial, Helvetica]Hi,,
I tried to access database from VB6 n ended up this error
my all SELECT statement,reports work fine. This statement doesn't work

This is my statement which gives me error as "syntax error in string in query expression '45')"

Con.Execute "INSERT INTO Sold_Products_Temp(Date_sold,Product_Code,Description,Sold_rolls,Sold_mts,Category) VALUES (#" & DTPicker1.Value & "#,'" & Text1(0).Text & "','" & Text1(1).Text & "'," & toNumber(Text1(5).Text) & "," & toNumber(Text1(6).Text & " ,'" & Text1(4).Text) & "')"

can anyone suggest solution plz.

many thanks
[/FONT]
 

DCrake

Remembered
Local time
Today, 09:38
Joined
Jun 8, 2005
Messages
8,632
The only time you can use .text is when the control has the focus. Remove this syntax and retry.
 

boblarson

Smeghead
Local time
Today, 01:38
Joined
Jan 12, 2001
Messages
32,059
bndck - It looks like you are adding single quotes to a field which is expecting a number (the place where you are getting the number 45). Remove the quotes and try again.
 

Users who are viewing this thread

Top Bottom