How to clear an option group once checked?

uwm3

New member
Local time
Today, 06:53
Joined
Mar 31, 2014
Messages
4
Hi,

In creating a form with checkboxes created using the "option group" control type,

I am trying to find a way to clear all the checkbox options in an option group after having checked an option. For instance, if the user checks one of the options but then decides they actually want to skip that question altogether and leave it blank - is there a way to clear all options, or reset the question?

Thanks!
Tristan
 
This is the original poster again. I've noticed that on the form, I can right click on whichever checkbox in the option group is checked, and select "Does Not equal [value]" and that unchecks the box on the form. But whichever option was checked when I hit save, the data table records that value and does not clear it. So it really isn't cleared in the table, which I also need. Suggestions?
 
click a button and

myoptiongroup = 0, or maybe myoptiongroup=null
 
click a button and

myoptiongroup = 0, or maybe myoptiongroup=null

Could you elaborate on that? When you say "click a button," which button do I click? At what point do I type in "myoptiongroup = 0?" Do I put that in the VBA code for an event or... I'm not sure how to use the information you gave me.
 
an option group mandates you select one only of the buttons, normally

in order to clear the option group, you would need to add a button to your form for that purpose. I can't quite see the value of clearing the option group. The alternative is to have an additional option called "no selection", or something similar

normally, each button in an option group has a value 1,2,3 etc. the value of the group is equivalent to the value of the selected option. therefore if you set the group to a value that is not one of the options, the effect will be to clear the group
 
Thank you Gemma-the-husky

I figured out that I can, as you said, put a command button in, and then put VBA code in so that "on click," the option group value = 0.

The code looks like this:

Private Sub CommandButton_Click()
Me.[GroupName] = 0
End Sub

This is a form used for people to enter data from paper files into the database. If they start checking boxes and realize that on a particular record that information is actually missing, they can clear the responses and not be forced to make a choice for data that doesn't exist.
 
Or like Gemma suggested, create another option in the option group. For example "No Data Available". Then in code, make sure this option assigns "nothing" to your data record. What you are defining as nothing depends on how you set up the record.
 

Users who are viewing this thread

Back
Top Bottom