Update Checkbox in Form based on 2 other checkboxes

KEKeogh

Registered User.
Local time
Today, 16:37
Joined
May 4, 2011
Messages
80
OK I'm just not seeing this.

This is what I need to do with 3 checkboxes:

When either Checkbox [Monday Prog1] or Checkbox [Monday Prog2] are checked, I need the [Monday] checkbox checked. Then likewise unchecked with the same criteria.

I tried doing a bunch of different codes in the after update field of the 1st 2 checkboxes with no luck. Some of them updated the [Monday] box to checked but wouldn't uncheck it.

Then I tried the codes in the [Monday] box again with no luck.

Anyone know a code I can use?

Kathie
 
Hi

You may like to try this:

Cut and paste this sub into the form's module
Code:
Private Sub SetCmbValues()
    If Me.Monday_Prog1 = True Or Me.Monday_Prog2 = True Then
        Me.Monday = True
    Else
        Me.Monday = False
        Me.Monday_Prog1 = False
        Me.Monday_Prog2 = False
    End If
End Sub

Put these 2 lines in the After UpDate event of "Monday" checkbox
Code:
    Me.Monday_Prog1 = Me.ActiveControl
    Me.Monday_Prog2 = Me.ActiveControl

Put this line in the After Update event of the other 2 checkbox
Code:
    SetCmbValues
 
If I understand your issue correctly the code below should work:

Code:
Function ManageChkMonday()
If Me.chkMondayProg1 = True Or Me.chkMondayProg2 = True Then
    Me.chkMonday = True
Else
    Me.chkMonday = False
End If
End Function

Copy and past this user devined function in the code of your form and then change the control names ("chkMondayProg1", "chkMondayProg2" and "chkMonday") to the actual names of your respective controls.

Then in the After Update event of each of the two check boxes (Monday Prog1 and Monday Prog2) add the following line of code to call the user defined funciton:

Code:
ManageChkMonday
 

Users who are viewing this thread

Back
Top Bottom