If check box true subform visable

cktcPeterson

Member
Local time
Today, 07:18
Joined
Mar 23, 2022
Messages
74
I have a check box.
If/when I click it I want my subform to be visible. So check box is true
If/when I click again, I want my subform to be not visible. so check box false.

My checkbox name is: Reoccuring Payment
My subform name is: RC Breakdown subform

I can rename them if easier.

Thanks
 
On the click event you should be able to do it

By the way, avoid using spaces on names

Code:
Private sub Reocurring_Payment_Click()

Me.RC_Breakdown.visible = Me.Reoccurring_Payment.Value

End Sub

If the checkbox is empty the value is False

So if you want to have it visible on True you can place a "Not" if front of Me.Reoccurring_Payment.Value

Code:
Me.RC_Breakdown.visible = Not Me.Reoccurring_Payment.Value
 
unbound checkboxes can have a null value so depending on whether or not you want the subform to be visible when the form first opens, set the the checkbox default value to No/False/0 if not to be visible or yes/true/-1 if to be visible.

in the Reoccurring_Payment checkbox click event put

RC_Breakdown.visible = Reoccurring_Payment

and in the form current event put

Reoccurring_Payment_Click

if you don't set the Reoccurring_Payment default value then the click event code would be

RC_Breakdown.visible = nz(Reoccurring_Payment,0)
 

Users who are viewing this thread

Back
Top Bottom