Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Option Buttons & Frame....

Status
Not open for further replies.

stlrain95

Programmer
Sep 21, 2001
224
US
I have 2 option buttons within a frame.

If one of the buttons is marked....then I need a combo box to be visible. Otherwise, no.

the button has a value of 2.

When I have tried to do this it doesn't appear? Not sure what I have done wrong.

Also,
When I reopen the form...the other button is clicked instead of the default? How to change that?
 
A very basic way to do it, someone with a better structured use of VBA may be able to give you a better option, but:

If you put the following code into “Got Focus” events of the option buttons:

Private Sub Option1_GotFocus()
Combo1.Visible = False
End Sub

Private Sub Option2_GotFocus()
Combo1.Visible = True
End Sub

(with the code obviously the names of your controls will be whatever you have set them to)

And set the “Visible” property of the combobox to “False” then this should work.

Mikee.
 
If the option buttons were created with the Option Group tool, you can reference the value of the frame (the frame takes the value of the selected option button).

Put the code in the after update event of the frame.

Private Sub fraOptions_AfterUpdate()

If fraOptions = 2 Then
cboName.Visible = True
Else
cboName.Visible = False
End If

End Sub

To force the user to make a choice, do not set a default value for the option group.



Larry De Laruelle
ldelaruelle@familychildrenscenter.org

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top