View Single Post
  #3 (permalink)  
Old 12-30-03, 04:04
CyberLynx CyberLynx is offline
Stuck on my opinions...
 
Join Date: Nov 2003
Posts: 1,487
Create all your subforms onto the form which contains the buttons. Make sure each subform control has the Visible property set to False. Now, use each button on your form to set the Visible property for each corresponding subform to True and all others to False (You can create a procedure to do this). You can also set the subform size/positioning properties (Left, Top, Height, & Width) from your buttons or procedure as well. Just off the top of my head...

Example:
In the OnClick event of your buttons:

Code:
Private Sub Command1_Click ()
   'View a specific SubForm Control   
   Call OpenMySubForm(Me.mySubFormName1)
End Sub

Private Sub Command2_Click ()
   'View a specific SubForm Control 
   Call OpenMySubForm(Me.mySubFormName2)
End Sub

'etc.....
Copy and paste this procedure into the same form code module that contains the buttons and subforms:

Code:
Private Sub OpenMySubForm (Sfrm as Control)
   'Close ALL SubForm Controls.
   Dim Ctrl as Control
   For Each Ctrl In Me.Controls
        If Ctrl.ControlType = acSubform Then Ctrl.Visible = False
   Next Ctrl
   'Position The SubForm Control. 
   Sfrm.Left = WhereverYouWantIt      '(in twips - 1" = 1440 twips)
   Sfrm.Top = WhereverYouWantIt      '(in twips - 1" = 1440 twips)
   Sfrm.Height = WhereverYouWantIt   '(in twips - 1" = 1440 twips)
   Sfrm.Width = WhereverYouWantIt    '(in twips - 1" = 1440 twips)
   'Make the SubForm Visible.
   Sfrm.Visible = True
End Sub

There ya go....
Reply With Quote