Runtime Error 3134 (1 Viewer)

Nocodexp

New member
Local time
Today, 09:07
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 :)
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 14:07
Joined
Jul 9, 2003
Messages
13,357
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........
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 14:07
Joined
Jul 9, 2003
Messages
13,357
Also >>>& "','" & Me.Date & "','"<<<

Is that a Date?

If so it should be surrounded by #
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 14:07
Joined
Jul 9, 2003
Messages
13,357
Same here:-

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

If that's a date it should be surrounded by #
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 14:07
Joined
Jul 9, 2003
Messages
13,357
Also >>>& "','" & Me.Date & "','"<<<

"Date" is a reserved word you shouldn't use it in your code...
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 14:07
Joined
Jul 9, 2003
Messages
13,357
The Table name with Spaces!!

Get rid of them!

Otherwise format it like this:- [VENDOR PERFORMANCE RECORD]
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 14:07
Joined
Jul 9, 2003
Messages
13,357
you know you've got Me.REJECT_QTY in there twice?
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 14:07
Joined
Jul 9, 2003
Messages
13,357
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:

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 14:07
Joined
Jul 9, 2003
Messages
13,357

Cronk

Registered User.
Local time
Today, 23:07
Joined
Jul 4, 2013
Messages
2,532
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

Top Bottom