update statement runtime error

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am coding an unbound form. I need to update a Yes/No field with a checkbox.
This code works fine in one of my forms but generates a runtime error in
others.

cmd.commandtext="update tblEnroll set Private=" & chkPrivate & " where
EnrollID=" & txtEnrollID
cmd.execute

the same code in a different form gives the error:
cmd.commandtext="update tblSchool set Band=" & chkBand & " where SchoolID="
& txtSchoolID
cmd.execute

Run-time error -2147217900 (80040e14):
Syntax error in UPDATE statement.

The syntax is identical. why does one form do it and others not? Does anyone
know what the error code numbers mean? I couldn't find it in microsoft's msdn
files anywhere.
 
You may have problems with "Band" since "BAnd" (binary AND) is a reserved
word in JET 4.

Try enclosing your Field name in square brackets like [Band].
 
Back
Top