VBA Question (Making form elements Visible)

A

andyw

Hi,

I currently have this piece of code:

Private Sub Command19_Click()
Toggle20.Visible = True
End Sub

So when the button is pressed toggle20 becomes visable.

What do I need to add to this to to enable the toggle20 to become
hidden once again if the button is pressed once more?
 
F

Frank Stone

hi,
private sub commadn19_click()
if toggle20.visible = true then
toggle20.visible = false
else
if toggle20.visible = false then
toggle20.visible = true
end if
end if
end sub
 
D

Dale Preuss

Andy,

Try this:
Private Sub Command19_Click()
Toggle20.Visible = Not Toggle20.Visible
End Sub

Dale Preuss
 
F

Fritz Anton

... even more elegant...:

Private Sub command19_click()
Me.toggle20.Visible = Not (Me.toggle20.Visible)
End Sub

Fritz
 
Top