Toggle Button for Visible Command

B

Ben

I have a form that has several fields hidden (Not Visible). I want to be
able to click a toggle button and make those fields visible, then when I am
done entering data, click the button again and those fields hide.

My fields are:
Phase1
Phase1Status
Deliverable1
Deliverable1Status

All those fields are Visible = No. So, when I click the toggle button once
those fields should be Visible=Yes, then enter data, then click the toggle
button again and those fields hide.

Thanks
 
F

fredg

I have a form that has several fields hidden (Not Visible). I want to be
able to click a toggle button and make those fields visible, then when I am
done entering data, click the button again and those fields hide.

My fields are:
Phase1
Phase1Status
Deliverable1
Deliverable1Status

All those fields are Visible = No. So, when I click the toggle button once
those fields should be Visible=Yes, then enter data, then click the toggle
button again and those fields hide.

Thanks

You can use a Toggle Button, but a Command Button works just as well.
I take it there are additional controls on the form that will always
remain visible, and it is just these 4 controls you wish to toggle.
If so, in each of those 4 control's Tag property write:
ToggleMe


As the controls are originally not visible, set the Command Button
caption to "Show"

Then code the command button's click event:
If Me.CommandButtonName.Caption = "Show" Then
Me.CommandButtonName.Caption = "Hide"
Else
Me.CommandButtonName.Caption = "Show"
End If
Dim ctl as Control
For each ctl in Me.Controls
If ctl.Tag = "ToggleMe" then
ctl.Visible = Not ctl.Visible
End If
Next

Click the button will togglw the 4 controls Visible property and
change the caption accordingly.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top