manually unselecting lists in radio box, listbox etc

L

Luke

Okay this is probably a very dumb question but here it goes

I created a form for entering results. I'm using radio boxes,
listboxes and checkboxes which is bound to fields i created in a
table. I'm entering data, and i select say an item in the listbox..
Latter i change my mind and want it to be deslected, so no item is
selected. How do i do it? Ditto for radio boxes, combo boxes etc. With
checkboxes i can easily uncheck, but for the rest??

I'm a real newbie at this, so please give detailed instructions. :(

Thanks.
 
A

Allen Browne

If the radio buttons, check boxes, or option buttons are part of an option
group, set the value of the *group* to Null, e.g.:
Me.Frame0 = Null
For example, you could put a command button beside the option group, set its
On Click property to [Event Procedure], click the Build button (...) beside
the property, and then type that line into the sub.

If they are stand-alone controls, you probably want to set them to False.
If you want to do this programmaticaly, use:
Me.Checkbox0 = False

For combos, just delete the value in the box. To set the value
programmatically:
Me.Combo0 = Null

List boxes are a bit more involved, as the may be multi-select.
See the ClearList() function here:
http://allenbrowne.com/func-12.html
 
L

Luke

Hi

Thanks

So I need to create a command button beside each radio button and list
box for me to click to clear? Hmm that's a lot of work, plus i don't
have much screenspace.

Think will just stick to combo box and checkbox then. I know it's
technically not kosher, but i think i can live with no multi-select
and a bit slower speed.



If the radio buttons, check boxes, or option buttons are part of an option
group, set the value of the *group* to Null, e.g.:
    Me.Frame0 = Null
For example, you could put a command button beside the option group, set its
On Click property to [Event Procedure], click the Build button (...) beside
the property, and then type that line into the sub.

If they are stand-alone controls, you probably want to set them to False.
If you want to do this programmaticaly, use:
    Me.Checkbox0 = False

For combos, just delete the value in the box. To set the value
programmatically:
    Me.Combo0 = Null

List boxes are a bit more involved, as the may be multi-select.
See the ClearList() function here:
   http://allenbrowne.com/func-12.html
--
Allen Browne - Microsoft MVP.  Perth, Western Australia
Tips for Access users -http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.


Okay this is probably a very dumb question but here it goes
I created a form for entering results. I'm using radio boxes,
listboxes and checkboxes which is bound to fields i created in a
table. I'm entering data, and i select say an item in the listbox..
Latter i change my mind and want it to be deslected, so no item is
selected. How do i do it? Ditto for radio boxes, combo boxes etc.
With checkboxes i can easily uncheck, but for the rest??
I'm a real newbie at this, so please give detailed instructions.  :(
 
M

Mr B

Luke,

Here is another way to manage radio buttons in a frame control:

Declare a variable in the "Declarations" area of your form like:
Dim bytFrameVal as Byte

In the "After Update" event of your frame control use code like this:
bytFrameVal = Me.NameOfYourFrameControl

In the "Mouse Up" event of each option button control in the frame control
use code like this:

If bytFrameVal = 1 Then
'clear the previously selected value
Me.NameOfYourFrameControl = 0
'reset the variable so an option can be selected
bytFrameVal = 0
End If

If you use this type of coding for your frame controls, if a user clicks a
radio button that is the currently selected option for the frame control, the
frame control is set to zero, thus clearing the selected radio button but
still allowing the user to make any selection from the group.

Also be aware that using this method, if your applicaiton requires that a
selection be made from your frame control, you will have to also have code
that will check to be sure that the value of your frame control is not still
zero before allowing users to save the current record.

This method takes a little coding but is quite effective for clearing
selections.

This does not help with the other types of controls in your OP.

--
HTH

Mr B
askdoctoraccess dot com


Luke said:
Hi

Thanks

So I need to create a command button beside each radio button and list
box for me to click to clear? Hmm that's a lot of work, plus i don't
have much screenspace.

Think will just stick to combo box and checkbox then. I know it's
technically not kosher, but i think i can live with no multi-select
and a bit slower speed.



If the radio buttons, check boxes, or option buttons are part of an option
group, set the value of the *group* to Null, e.g.:
Me.Frame0 = Null
For example, you could put a command button beside the option group, set its
On Click property to [Event Procedure], click the Build button (...) beside
the property, and then type that line into the sub.

If they are stand-alone controls, you probably want to set them to False.
If you want to do this programmaticaly, use:
Me.Checkbox0 = False

For combos, just delete the value in the box. To set the value
programmatically:
Me.Combo0 = Null

List boxes are a bit more involved, as the may be multi-select.
See the ClearList() function here:
http://allenbrowne.com/func-12.html
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users -http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.


Okay this is probably a very dumb question but here it goes
I created a form for entering results. I'm using radio boxes,
listboxes and checkboxes which is bound to fields i created in a
table. I'm entering data, and i select say an item in the listbox..
Latter i change my mind and want it to be deslected, so no item is
selected. How do i do it? Ditto for radio boxes, combo boxes etc.
With checkboxes i can easily uncheck, but for the rest??
I'm a real newbie at this, so please give detailed instructions. :(
 

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