Unable to put CurrentDb.Execute in one line geting error with & _ Plz Help..

bvijay

New member
Local time
Today, 08:46
Joined
May 3, 2016
Messages
2
CurrentDb.Execute "INSERT INTO MyDATA (Dealer, Sev, Vin, Engine_no, Color, REgno, Var, Mileage, Repair_dt, Sale_date, Part_no, Comp, Opcondition, inv_det, Tech_ob, Susp, Corr, Taccomm, Finalcomm, filename, defect,category,model,prod_dt,BP,partname,step1,step2,step3,step4,step5,step6_1,step6_1d,step6_2,step6_2d,step6_3,step6_3d,step6_4,step6_4d,step7,step8) values ('" & dlr.Value & "','" & Sev.Value & "','" & Vin.Value & "','" & Eng.Value & "','" & Color.Value & "','" & reg.Value & "' , ‘”& Var.Value & "','" & mil.Value & "',#" & Format(repdt.Value, "MM/DD/YY") & "#,#" & Format(dos.Value, "MM/DD/YY") & "#,'" & part.Value & "','" & Comp.Value & "','" & opc.Value & "','" & inv.Value & "','" & techob.Value & "', '" & Susp.Value & "','" & Corr.Value & "','" & taccom.Value & "','" & fincom.Value & "','" & FILEPATHLOAD & "','" & Combo44.Value & "','"& CAT.Value & "','" & mdl.Value & "',#,"& Format(proddt.Value, "mm/dd/yy") & "#," & bps & ",'" & Text61.Value & "','" & Step1.Value & "','" & step1d.Value & "','" & step2.Value & "','" & step2d.Value & "','" & step3.Value & "','" & step3d.Value & "','" & Step4.Value & "', '" & step4d.Value & "','" & step5.Value & "','" & step5d.Value & "','"step6_1.Value & "','" & step6_1d.Value & "','" & step6_2.Value & "','" & step6_2d.Value & "','" & step6_3.Value & "','" & step6_3d.Value & "','" & step6_4.Value & "','" & step6_4d.Value & "','" & step7.Value & "','" & step8.Value & "')
 
I don't know what exactly your problem is, but you've some "bad" character in your string, (there can be more, I didn't check it).
"','" & Eng.Value & "','" & Color.Value & "','" & reg.Value & "' , ‘”& Var.Value & "','" & mil.Value & "',#" &
If you want to break a long code line then use underscore.
An example:
Code:
AVariable= "A very long code line breaks into " [B][COLOR=Red]_[/COLOR][/B]
[B][COLOR=Red]&[/COLOR][/B] "2 code lines"
 
Your query is a nightmare and the problem began with your data structure.

All those repeating "step" names. That data should be in a different table as records instead of separate fields.

BTW There is no need to include the .Value property because Value is the default property.
 

Users who are viewing this thread

Back
Top Bottom