Replacing txtMentioned and txtNotMentioned with the actual names of the Textboxes you want to display the results (and these Controls should not be Bound, as they're calculated results, and should simply be re-calculated, as needed) and place this code in the Form's Code Module:
Code:
Public Sub Total_CBOs()
Dim ctl As Control
Dim Mentioned As Integer
Dim NotMentioned As Integer
Mentioned = 0
NotMentioned = 0
For Each ctl In Me.Controls
If TypeOf ctl Is ComboBox Then
If ctl = "Mentioned" Then Mentioned = Mentioned + 1
If ctl = "NoT Mentioned" Then NotMentioned = NotMentioned + 1
End If
Next ctl
Me.txtMentioned = Mentioned
Me.txtNotMentioned = NotMentioned
End Sub
Now, in the AfterUpdate event of each Combobox, place this code:
In order to have the totals show, as you move from Record-to-Record, place the same code in the Form_Current event of the Form.
Linq ;0)>
The problem with making anything foolproof...is that fools are so darn ingenious!
All posts/responses based on Access 2003/2007