Linking forms 2

  • Thread starter Thread starter Tara
  • Start date Start date
T

Tara

I just posted a question about linking forms, but thought
of another thing which might be an easier fix. I think
using a subform would be okay if it wasn't visible all of
the time. So, is there a way to make a subform invisible
uless a command button is clicked, then make it invisible
again when another command button is clicked?

Thanks again!
Tara
 
Sure is a way - and it only needs one button!

Use this code for your button:

Private Sub btnShowSbfrm_Click()
Me.MySubformName.Visible = Not Me.MySubformName.Visible
If Me.MySubformName.Visible Then
btnShowSbfrm.Caption = "Hide Subform"
Else
btnShowSbfrm.Caption = "Show Subform"
End If
End Sub

Make sure you set the default caption for the button to match the default
subform visibility, otherwise they won't be "in sync" when you first open
the form.

Rob
 
Back
Top