Accessing and manipulating sub-form information with VBA (1 Viewer)

Lkwdmntr

Registered User.
Local time
Yesterday, 20:09
Joined
Jul 10, 2019
Messages
277
Hello again,

I am working on a point system for items that are checked off in a form. I have five separate subforms within the one daily form and point totals on the bottom. What would be ideal is if when a checkbox is checked it adds one to the appropriate totals field. So here is some information that may help to develop some code.

Forms
Form_FRM_Mon_Challenges - Main form
Sub_MonSTChallenges, Sub_MonSAChallenges, Sub_MonBAChallenges, Sub_MonMALChallenges, FRM_Non_Standard_Actions_subform.

Fields
StartTimeChallengeYes, StartTimeChallengeYNo, ActivityChallengeYes, ActivityChallengeNo, Tab1, Tab2, MonActAcntPts, MonActAchPts.

Also, the "Tab" fields I would like to access and if there is no number in the field then lock the Yes/No checkboxes.

Any help would be greatly appreciated. Going to bed now (12:50 am), but will get back to this tomorrow. Thanks
 

June7

AWF VIP
Local time
Yesterday, 19:09
Joined
Mar 9, 2014
Messages
5,466
Aggregate data should not be saved, it should be calculated from transaction records.

Might consider Conditional Formatting to disable checkbox per record based on value of another field/control.

If you want to provide db for analysis, follow instructions at bottom of my post.
 
Last edited:

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 20:09
Joined
Oct 29, 2018
Messages
21,455
Just FYI, I don't think conditional formatting applies to checkboxes.
 

Lkwdmntr

Registered User.
Local time
Yesterday, 20:09
Joined
Jul 10, 2019
Messages
277
I tried this, but it doesn't work, but I think something like this might. Maybe some pro's out there can help tweak this to work. If I can get it to work in one subform, then I should be able to get it to work in all of them.

Private Sub StartTimeChallengeYes_Click()

If Me.ActivityChallengeYes = True Then

Form_FRM_Mon_Challenges.MonActAcntPts.Value = Form_FRM_Mon_Challenges.MonActAcntPts.Value + 1
Form_FRM_Mon_Challenges.MonActAchPts.Value = Form_FRM_Mon_Challenges.MonActAchPts.Value + 1
Else
Form_FRM_Mon_Challenges.MonActAcntPts.Value = Form_FRM_Mon_Challenges.MonActAcntPts.Value - 1
Form_FRM_Mon_Challenges.MonActAchPts.Value = Form_FRM_Mon_Challenges.MonActAchPts.Value - 1

End If

End Sub
 

Users who are viewing this thread

Top Bottom