I have found the following function and I've been able to get it working, but on my continuous form it only counts 1 even if more boxes are checked. I can not use =Abs(Sum([the field])) in the record source of a field, as the field that I need to show the calculated number is linked to a table. I am fully aware of the arguments for not recording calculated information, but this is to record the Total number of students present based on the number of "Present" checkboxes that are checked in the Continuous Subform. How can I alter this function code to get the sum of checked boxes in my continuous form.
Here is the code!
Function CountChecked() As Integer
Dim intTotalChecked As Integer
Dim ctl As Control
intTotalChecked = 0
For Each ctl In Me
If ctl.ControlType = acCheckBox Then
If ctl.Value = True Then
intTotalChecked = intTotalChecked + 1
End If
End If
Next
CountChecked = intTotalChecked
End Function
Any help would be great!
Here is the code!
Function CountChecked() As Integer
Dim intTotalChecked As Integer
Dim ctl As Control
intTotalChecked = 0
For Each ctl In Me
If ctl.ControlType = acCheckBox Then
If ctl.Value = True Then
intTotalChecked = intTotalChecked + 1
End If
End If
Next
CountChecked = intTotalChecked
End Function
Any help would be great!