update statement runtime error

M

matt

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.
 
V

Van T. Dinh

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].
 

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