Can I use a single toggle button to Hide or Show a form?

E

efandango

I have tried to use a single toggle button to show or hide a form, but the
best I can manage is having to use two buttons.

Is it possible to use just the one button to toggle between show/hide?
 
F

fredg

I have tried to use a single toggle button to show or hide a form, but the
best I can manage is having to use two buttons.

Is it possible to use just the one button to toggle between show/hide?

Sure! But the toggle button can't be on the form that you are making
visible or not, as once it's not visible you can't click on the toggle
button.

What version of Access?
Access 2000 or newer?

Code the toggle button Click event:

If CurrentProject.AllForms("AFormname").IsLoaded Then
forms!AFormName.Visible = Not forms!AFormName.Visible
If ToggleName.Caption = "Make Visible" then
ToggleName.Caption = "Hide"
Else
ToggleName.Caption = "Make Visible"
Ehd If
End If
 
Top