Clearing a check box on Close

M

Mary

I have a table with a yes/no field. I would like the field value to change from a yes to a no when I close the table. Effectively, deselecting the check box associated with the yes/no field on a form.
 
F

fredg

Mary said:
I have a table with a yes/no field. I would like the field value to
change from a yes to a no when I close the table. Effectively,
deselecting the check box associated with the yes/no field on a form.

Mary,
There is no way to do this if you are in Table view.
However, if you are using a Form, Continuous Form, or Form Datasheet
view, you can place code in the Form's Close event to set the Check Box
field to No:

CurrentDb.Execute "Update YourTable Set YourTable.CheckBoxFieldName =
0;", dbFailOnError

Each time the form is closed, all records will be reset to No.
 

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