Runtime Error 3134

Nocodexp

New member
Local time
Today, 02:14
Joined
Jul 10, 2014
Messages
4
Hi,
I was just following some coding from a tutorial and I've ran into the runtime error 3134 "Syntax error in INSERT INTO statement". I checked the coding and I believe everything is where it's at, however, the yellow arrow is pointed at the bottom line, where I guess where there is a fault?
Code:
CurrentDb.Execute "INSERT INTO VENDOR PERFORMANCE RECORD (QIRNO,PN,QCCODE,Description,VENDORName,INSDATE,PONO,Line,Release,Receipt,DATERECEIVED,LOTSIZE,SAMPLEQTY,REJECTQTY,INSPECTOR,TOTREJECTED,QCCOMMENTS,Rejected,NCRNO,INSLOCATION) " & _
    "VALUES(" & Me.txtQIR & ",'" & Me.cboPN & "','" & _
    Me.QCCode & "','" & Me.Description & "','" & Me.cboVendor & "','" & Me.DATE & "','" & Me.RIP_NO & "','" & Me.Text127 & "','" & _
    Me.Text129 & "','" & Me.Text131 & "','" & Me.DATE_RECEIVED & "','" & Me.LOT_SIZE & "','" & Me.SAMPLE_QTY & "','" & Me.REJECT_QTY & _
    "','" & Me.Inspector & "','" & Me.REJECT_QTY & "','" & Me.txtComments & "','" & Me.Total_Quantity_Rejected & "','" & Me.Text66 & "','" & _
    Me.txtINSLOC & "')"

Don't mind my naming conventions, these are just placeholders until I get this fixed.
Any help would be appreciated :)
 
try spacing these properly:-
QIRNO,PN,QCCODE,Description,VENDORName,INSDATE,PONO,Line,Release,Receipt,

Should be like this:-
QIRNO, PN, QCCODE, Description, VENDORName, INSDATE, PONO, Line, Release, Receipt, .....and the rest........
 
Also >>>& "','" & Me.Date & "','"<<<

Is that a Date?

If so it should be surrounded by #
 
Same here:-

>>>'" & Me.DATE_RECEIVED & "','" & <<<

If that's a date it should be surrounded by #
 
Also >>>& "','" & Me.Date & "','"<<<

"Date" is a reserved word you shouldn't use it in your code...
 
The Table name with Spaces!!

Get rid of them!

Otherwise format it like this:- [VENDOR PERFORMANCE RECORD]
 
you know you've got Me.REJECT_QTY in there twice?
 
I've done a YouTube Video on "Formatting an SQL Insert Statement"

Follow the instructions in the Video, basically I show you a very simple and repeatable way to easily handle SQL Statements.

By following these instructions you can sort out many SQL formatting problems on your own.
 
Last edited:
Also by the names, the fields
LOTSIZE, SAMPLEQTY, REJECTQTY, TOTREJECTED
would appear to be numeric


If so, remove the single quotes around the data being inserted.
 

Users who are viewing this thread

Back
Top Bottom