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

Question on SubForms

Status
Not open for further replies.

bjayhome

Technical User
Dec 13, 2001
17
0
0
US
I have a subform and 5 option buttons on a main form. What I would like to do is to change the form shown on the subform to a different one each time a different option button is clicked. (I have also created 5 forms that I would like to see appear on the subform on my main form.)
Can someone help me? Thank you :) in advance for your help.
 
in the buttons on click event set the subforms.visible propert to true the others to false. do this for each button
example;
me.subform1.visible = false
me.subform2.visible = true
me.subform3. = false
 
Hi Bjayhome

This should do the trick

Use the OnClick event for the option box and write a case select statement example below (option group is call optselect in this example)

Private Sub optSelect_Click()

Select Case ([optSelect])
Case 1: [Subform1].SourceObject = "frm1"
Case 2: [Subform1].SourceObject = "frm2"
Case 3: [Subform1].SourceObject = "frm3"
Case 4: [Subform1].SourceObject = "frm4"
Case 5: [Subform1].SourceObject = "frm5"
End Select

End Sub

Hope this helps
 
Thank you for 'ChrisBelzona' and 'braindead2' for the quick responce.
I did try both and they work fine. But I decide to use 'Select case' method as 'ChrisBelzona' suggested.

bjayhome
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top