Victor Anzala
Victor Anzala

Reputation: 55

Access VBA - run time error '3075'

For starters, I have practically no knowledge of VBA Code. What I'm trying to do here is take information from a form and subform and enter it as a new record into a table that is set as the record source of the subform.

The error code reads: run time error '3075':

Syntax Error (Missing Operator) in query expression 'GENERAL METAL (CUBEX)'.

Also I apologize for how messy it is. I honestly just tried to copy what I saw in a YouTube video that kind of represented what I was trying to do.

CurrentDb.Execute "INSERT INTO workingorders(customer, partname, partnumber, metal, grade, unitweight, Process, subcontract, MoldDescription, moldlocation, specialconcerns, shippinginst, datereq, orderdate, qtyordered, qtycast) " & _
" VALUES(" & Me.customer & ", '" & Me.partname & "','" & Me.partnumber & "','" & Me.metal & "','" & Me.grade & "','" & Me.unitweight & "','" & Me.Process & "','" & Me.subcontract & "','" & Me.MoldDescription & "','" & Me.moldlocation & _
Me.specialconcerns & "','" & Me.shippinginst & "','" & Me.datereq & "','" & Me.orderdate & "','" & Me.qtyordered & "','" & Me.qtycast & "')"

Upvotes: 0

Views: 5291

Answers (1)

Johnny Bones
Johnny Bones

Reputation: 8402

This part concerns me: '" & Me.moldlocation & _ Me.specialconcerns & "'

It looks like you're missing the closing quote before the line suppression. Any time you see "& _" it's telling the code that you're moving to a new line, but to supress that line break when the code is run. You generally need to close up your quotes before you do that, just like was done in the other line suppressor: qtycast) " & _ " VALUES(

So, in short, give this a shot:

CurrentDb.Execute "INSERT INTO workingorders(customer, partname, partnumber, metal, grade, unitweight, Process, subcontract, MoldDescription, moldlocation, specialconcerns, shippinginst, datereq, orderdate, qtyordered, qtycast) " & _ 
" VALUES(" & Me.customer & ", '" & Me.partname & "','" & Me.partnumber & "','" & Me.metal & "','" & Me.grade & "','" & Me.unitweight & "','" & Me.Process & "','" & Me.subcontract & "','" & Me.MoldDescription & "','" & Me.moldlocation "'," & _ 
"'" & Me.specialconcerns & "','" & Me.shippinginst & "','" & Me.datereq & "','" & Me.orderdate & "','" & Me.qtyordered & "','" & Me.qtycast & "')"

Since I don't know your data, I'll just remind you that anything that's TEXT needs to be enclosed with single quotes (i.e. '" & Me.grade & "',) and anything that's an INT does not need the single quote (i.e. " & Me.customer & ",). Just make sure all your variables are enclosed accordingly or that will cause an error as well.

If this answers your question, please don't forget to give the answer a checkmark. Thanks!

Upvotes: 3

Related Questions