Discussion Locked

VB: Options Buttons & a Default Value

0 helpful
11 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

How do I create a group of option buttons (radio buttons) and prevent them from appearing which one option already selected?(e.g. a default selection)

When I set all the value properties to false, the first option button shows up as selected.

11 replies

by tclere

Make sure that you do not use the SetFocus method, which will activate the option. Try it on a blank form, setting all of the value properties to false will deactivate all selections. You may have some other code that is causing this to happen.

by ramesh vishnubhatla

Usually Option buttons are used when the answers to a question is from a pre-defined list. So, one of them has to be selected. If you want to handle a situation when none of the options is valid, then you may try these two things:

  • Have another option button with a caption "No Selection" or something like that.
  • Have a Check box, which when checked will enable a frame containing the option buttons and when unchecked diables the frame. In the code, you can check for thevalue of the Check box before proceeding to evaluate the value of an option button.

Hope this answer helps.

by trishs

It could be that the option group is the first item in the TabIndex - when the form loads, it receives the focus and the first option gets selected. Set the TabIndex of something else to 0, and you should have no problems.

by donq

If your Option Group is linked with a Field within a Table make sure its Default Value is Null, When you create an Option Group you are allowed to create one where one of yout pre-defined values is used as a "Default", or select the No Nefault Option which should open the entire group (for a new record) whit every button greyyed. When the Form indexes to a selected record (where an attached field is linked to the group) the selected option should change from record to record. When I use the Wizard to create the Group (and mess up) I just delete it and start over - it only takes a minute?

by kellyl

Create an extra option button and set its value to True. Then using the properties page "move" this button to where it is not visiable in the group box. You may then check its value in code to see if the user has selected an option.

This discussion is closed to new replies.