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!

How to have a button appear on form only when other form NOT open

Form Basics

How to have a button appear on form only when other form NOT open

by  assets  Posted    (Edited  )
This will open a form and not display the close button ( or any other button). If a particular form is open in this case "TheOtherForm" then the button on "ThisForm" will be displayed. You can use this to run reports or for admin function ( if the "TheOtherForm" is the menu then user will not see the button.
The code below goes into the "On Open" properties [Event Procedure].on the form you want to show/hide the button.
Private Sub Form_Open(Cancel As Integer)

If IsLoaded("TheOtherForm") Then
' If the TheOtherForm is open
' the form is opened
' show form's Close/Other button.
CmdCloseForm.Visible = True
Else
' This form was opened as an application
' "Thisform" so hide the button
CmdCloseForm.Visible = False
End If

End Sub
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top