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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sub form still showing

Status
Not open for further replies.

ugly

Programmer
Joined
Jul 5, 2002
Messages
70
Location
GB
I have a form that includes a group of 3 radio buttons. Three subforms sit on this main form and I have set their visibility property to false so that they don’t show at start up. The visibility of the subforms is controlled through the radiobuttons , I coded each radio button as follows

Private Sub Option13_GotFocus()
form1.Visible = True
End Sub

Private Sub Option13_LostFocus()
form1.Visible = False
End Sub
Private Sub Option15_GotFocus()
Form2.Visible = True
End Sub

Private Sub Option15_LostFocus()
form2.Visible = False
End Sub

Private Sub Option17_GotFocus()
form3.Visible = True
End Sub

Private Sub Option17_LostFocus()
form3.Visible = False
End Sub
This does have the effect of toggling the visibility of the subforms, the problem is that when the main form first appears one of the subforms is visible even thought I set its Visible property as false. Introducing the radio buttons seems to be affecting the initial visibility of one of the subforms. Initially NONE of the radio buttons is selected. Not sure whats going wrong?
 
I think you would be better using the Click event:

Code:
Private Sub Option13_Click()
'It will be visible if option13 is selected
form1.Visible = Me.Option13 
End Sub

Add similar code to the Current event of the form:

[tt]form1.Visible = Me.Option13[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top