G
Guest
I was hoping someone could assist me on this. I have several check boxes. I
want to be able to count certain ones and populate an unbound textbox with
this number. I use this number in other procedures on the form. Currently I
am using the formula for every check box on click. However, instead of doing
this, is there a way that I can place this in a module then reference it with
on click? Here is my code:
Private Sub chk1_Click()
Dim X, a, b, c, d, e, f, g As Integer
X = 0
If Me.chk1 = True Then
a = 1
Else
a = 0
End If
If Me.chk2 = True Then
b = 1
Else
b = 0
End If
If Me.chk3 = True Then
c = 1
Else
c = 0
End If
If Me.chk4 = True Then
d = 1
Else
d = 0
End If
If Me.chk5 = True Then
e = 1
Else
e = 0
End If
If Me.chk6 = True Then
f = 1
Else
f = 0
End If
If Me.chk7 = True Then
g = 1
Else
g = 0
End If
X = a + b + c + d + e + f + g
Me.NumberOfSectionsSelected = X
End Sub
thanks
want to be able to count certain ones and populate an unbound textbox with
this number. I use this number in other procedures on the form. Currently I
am using the formula for every check box on click. However, instead of doing
this, is there a way that I can place this in a module then reference it with
on click? Here is my code:
Private Sub chk1_Click()
Dim X, a, b, c, d, e, f, g As Integer
X = 0
If Me.chk1 = True Then
a = 1
Else
a = 0
End If
If Me.chk2 = True Then
b = 1
Else
b = 0
End If
If Me.chk3 = True Then
c = 1
Else
c = 0
End If
If Me.chk4 = True Then
d = 1
Else
d = 0
End If
If Me.chk5 = True Then
e = 1
Else
e = 0
End If
If Me.chk6 = True Then
f = 1
Else
f = 0
End If
If Me.chk7 = True Then
g = 1
Else
g = 0
End If
X = a + b + c + d + e + f + g
Me.NumberOfSectionsSelected = X
End Sub
thanks