Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

3134 Syntax error in INSERT INTO statement 1

Status
Not open for further replies.

ajaeger

Technical User
Feb 6, 2003
201
US
I'm getting the error "3134 Syntax error in INSERT INTO statement" when I try to execute the following code:

sql = "Insert into dbo_Order_Lines (ORDER_NUMBER,LINE_NUMBER,PRODUCT_CODE,DESCRIPTION,QUANTITY_ORDERED,QUANTITY_SHIPPED,UNIT_PRICE,
UNDISCOUNTED_PRICE,EXTENDED_AMOUNT,UNDISCOUNTED_EXTENDED_AMOUNT, NOTE) "
sql = sql & "values ('" & OrderNum & "','" & LineNum & "','" & Product & "','" & ProductDesc & "',1,1," & ProductPrice & "," & ProductPrice & "," & ProductPrice & "," & ProductPrice & ",'" & rsAttendees!Grade & "')"

db.Execute (sql)


The actual sql that is generated by the code is:
Insert into dbo_Order_Lines
(ORDER_NUMBER,LINE_NUMBER,PRODUCT_CODE,DESCRIPTION,QUANTITY_ORDERED,QUANTITY_SHIPPED,UNIT_PRICE,
UNDISCOUNTED_PRICE,EXTENDED_AMOUNT,UNDISCOUNTED_EXTENDED_AMOUNT
,NOTE)
values ('2987388','2','2009NLC/GRADE','Grade - Enter 5-12 Under "Function Note" tab',1,1,0,0,0,0
,NOTE)

It will run if I delete the last field, the NOTE field where I'm assigning the value of '11' to it (in blue above). So it's something with that last field...


Anna Jaeger
iMIS Database Support
 
Assuming that NOTE is a text field the first thing I would notice is that NOTE is a reserved word in Access, might be worth changing the field name to something else as reserved words are better not used as field names.

Hope this helps

HarleyQuinn
---------------------------------
You can hang outside in the sun all day tossing a ball around, or you can sit at your computer and do something that matters. - Eric Cartman

Get the most out of Tek-Tips, read FAQ222-2244: How to get the best answers before posting.

 
Note is a memo field, but I can't change the name of it since it is in another SQL database. Is there anyway to work around this?

Anna Jaeger
iMIS Database Support
 
Have you tried:
Code:
Insert into dbo_Order_Lines
(ORDER_NUMBER,LINE_NUMBER,PRODUCT_CODE,DESCRIPTION,QUANTITY_ORDERED,QUANTITY_SHIPPED,UNIT_PRICE,
UNDISCOUNTED_PRICE,EXTENDED_AMOUNT,UNDISCOUNTED_EXTENDED_AMOUNT,[NOTE])

HarleyQuinn
---------------------------------
You can hang outside in the sun all day tossing a ball around, or you can sit at your computer and do something that matters. - Eric Cartman

Get the most out of Tek-Tips, read FAQ222-2244: How to get the best answers before posting.

 
Glad I could help, thanks for the star [smile]

HarleyQuinn
---------------------------------
You can hang outside in the sun all day tossing a ball around, or you can sit at your computer and do something that matters. - Eric Cartman

Get the most out of Tek-Tips, read FAQ222-2244: How to get the best answers before posting.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top