show and hide frms via command button

splreece

Registered User.
Local time
Today, 21:23
Joined
Jun 2, 2016
Messages
40
Hi all,

I am a basic user of access and have limited vba knowledge but am quite a quick study.

I have built an access application that has 3+ subforms. I show/hide these subforms via the below code:

Private Sub Check246_Click()
If Check246.Value = True Then
frmAltPaymentAddress.Visible = True
End If
If Check246.Value = False Then
frmAltPaymentAddress.Visible = False
End If
End Sub



I call the forms via check boxes as I can't figure out how to call via a command button.

I have tried using expression builder with the command button using iif statements but my variations haven't worked.

=IIf([Check295]=-1,[Check295]=0,[Check295]=-1

I know it is wrong, I just can't figure out how to get a command button to show (onclick) then hide (onclick) the sub form.

Any help is most appreciated.
 
Create the button, put in the code below in the click event.
Code:
Me.frmAltPaymentAddress.Visible = Not Me.frmAltPaymentAddress.Visible
 

Users who are viewing this thread

Back
Top Bottom