Syntax error in INSERT INTO

  • Thread starter Thread starter Mary Fran
  • Start date Start date
M

Mary Fran

Could someone please point out my error here? I'd greatly appreciate it!

ssql = "INSERT INTO Tbl_UniqueCourts (Court1, Court2, Court3, League, Date,
Rotation) VALUES ('" & sCourt1 & "','" & sCourt2 & "','" & sCourt3 & "'," &
Forms!frmRotation!League & ",#" & dtDate & "#," & intR & ")"
 
Is Leage a number? If not put a quote around that as well. Also, you may
need to add a space after each comma in the VALUES portion. Or, it could be
that there is an apostrophe in one of the values... it is recommended to use
two double quotes rather than a single quote... i.e. "" instead of '

Also, you have a field named Date, which is not only a reserved word but a
function as well. Change the name to something unambiguous.

So,

"INSERT INTO Tbl_UniqueCourts (Court1, Court2, Court3, League, fldDate,
Rotation) VALUES (""" & sCourt1 & """, """ & sCourt2 & """, """ & sCourt3 &
""", """ & Forms!frmRotation!League & ", #" & dtDate & "#, " & intR & ")"


hth

--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)
 
Back
Top