PDA

View Full Version : Access 2010 Form Hide/show button



newbieform12
06-09-2012, 07:11 PM
Hey Guys, need some help please



I have a form that contains information about the client. The client fields are – client’s first name, client’s last name, their street address, suburb and city, their landline number and their cell phone number and their email address.

I don't always want to see the email address and would like to have a button that will show or hide the email address.

Steve64
06-15-2012, 02:20 AM
make a command button, if you have the wizard on just cancel it, in the buttons "on click" event, choose [Event Procedure] then click on the 3 dots ... and then choose code

add this line between Private Sub Command1_Click() and End Sub

Me.YourTextboxName.Visible = False

to reshow the email another button with Me.YourTextboxName.Visible = True

MacroShadow
06-17-2012, 04:31 AM
I would use a toggle button. Using something like the following:

Private Sub tglbutton_Click()
If Me.tglbutton.Value = True Then
Me.YourTextboxName.Visible = True
Else
Me.YourTextboxName.Visible = False
End If
End Sub

Or

Private Sub tglbutton_Click()
Select Case tglbutton
Case True
Me.YourTextboxName.Visible = True
Case False
Me.YourTextboxName.Visible = False
End Select
End Sub

hansup
06-18-2012, 08:10 AM
I don't always want to see the email address and would like to have a button that will show or hide the email address.
If your command button is named cmdToggleEmail and the text box which holds the email address is named txtEmail, you could use this as the button's click event.Private Sub cmdToggleEmail_Click()
Me.txtEmail.Visible = (Not Me.txtEmail.Visible)
End SubIf txtEmail is visible, clicking the command button will hide it. If txtEmail is hidden, clicking the command button will show it.