Syntax error in INSERT INTO

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 & ")"
 
J

Jack Leach

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)
 
M

Mary Fran

It was the date.. I changed it to LDate and it worked fine... thanks so much!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top