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!

Button On Click Open Subform

Status
Not open for further replies.

jaanisf

Technical User
Apr 30, 2003
50
LV
Hi!
Seems like a simple thing but I do not know, how to make it. Well, I have an index form with a set of buttons. On pressing a button I want a subform to come up with another set of buttons according to the button pressed in an index form. And I want there a subform with no buttons when an index form opens. So, what I should write behind my first button's On Click, presuming I want a subform [sbfrmName1] to come up, and what I should write behind my index form's On Open, presuming I want a subform [sbfrmIndex] to come up?
Thanks in advance!
 
Why make a subform with buttons? I would suggest just adding the buttons to the form and set the Visible Properties to NO. Then add the following to the On Click event of a command button:

Me.NameofButton.Visible = True
Me.NameofButton2.Visible = True


If you really need to do this on a subform you can do the sme thing. Create teh subform with the buttons. Add it to the Main form and set the Visible Properties to NO. Then add the following to the On Click event of a command button:

Me.SubFormName.visible = False

To make it invisible with the click of another button the code is

Me.SubFormName.visible = True

HTH



"I know what you're t'inkin', ma petite. Dat Gambit... still de suave one, no?"
 
It does not work. Error 424: Object required.
And, I need 5 subforms, not one. All five in the same place. And every subform will contain also 5 buttons, so, if I do not use subforms, I have a mess with buttons in my index form.
 
Please post your code so that we can review it


"I know what you're t'inkin', ma petite. Dat Gambit... still de suave one, no?"
 
Private Sub btnIenaakumi_Click()
Subfindex.Visible = False
Subfienaakumi.Visible = True
End Sub
 
This was all I needed, now it works, thank you ;)

Private Sub btnIenaakumi_Click()
Me!subf.Visible = True
Me!subf.SourceObject = "SubfIenaakumi"
Forms!Index!subf.SetFocus
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top