deselect checkbox on exit from form

K

karingwood

I have set up a form allowing users to select items from a list. After the
user makes their selections, they run a query that provides them with their
list. Once this is done, I'd like to have the records deselected (so all
yes/no check boxes are blank). How do I accomplish this? The check boxes
don't reset when the form is exited and then reopened. Thank you very much.
 
J

Jeff Boyce

In code behind the form, perhaps in the form's Close event:

Me!Checkbox1 = False
Me!Checkbox2 = False
...

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
D

Dale Fye

What version of Access?

Is this a listbox, or a continuous forms with a field that is Yes/No. If it
is a continuous form, you will need to write and update query that sets all
of that field to false, and run it in the forms Close event. Something like:

Private Sub Form_Close

currentdb.execute "Update yourTable SET [YourYesNoField] = 0"

end sub

HTH
Dale
 
K

karingwood

Thank you for your quick reply. This doesn't seem to work, but it may be
that I need to provide you with a little more detail. The form has several
fields: Select (yes/no field in question), category, question id, question
description.

I tried this 2 ways. I tried using the exact syntax you provided below.
When I reopened the form, the check boxes were still checked.

Then I tried substituting the word 'Checkbox1" with "Select" and received
this error message:

The expression On Close you entered as the event property setting produced
the following error: The object doesn't contain the Automation object "Me.".

Can you tell me what I am doing wrong? Thanks so much!
 
J

Jeff Boyce

My "syntax" was only an example ... I suppose I should have clarified it as
"untested aircode".

Please copy the code you are using and paste it back here.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
K

karingwood

Dale--That did the trick. Thank you SOOOOooo much. Happy holidays to you.
BTW, I am using Access 2003. I have 2007 but am still irritated by the new
menus so I'm not using it as much as I ought to. Thanks again.

Kathy

Dale Fye said:
What version of Access?

Is this a listbox, or a continuous forms with a field that is Yes/No. If it
is a continuous form, you will need to write and update query that sets all
of that field to false, and run it in the forms Close event. Something like:

Private Sub Form_Close

currentdb.execute "Update yourTable SET [YourYesNoField] = 0"

end sub

HTH
Dale
--
Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.



karingwood said:
I have set up a form allowing users to select items from a list. After the
user makes their selections, they run a query that provides them with their
list. Once this is done, I'd like to have the records deselected (so all
yes/no check boxes are blank). How do I accomplish this? The check boxes
don't reset when the form is exited and then reopened. Thank you very much.
 
K

karingwood

Hi Jeff: Someone else posted a reply that did the trick for me. Thank you.
In case you are interested, I used your code exactly, just replaced
'checkbox1' with my field name. I appreciate your time. Happy holidays.

Kathy
 

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