You need essentially the same code to check them afterwords:
Dim a As Integer
Dim b As Integer
Dim c As Integer
Dim TotalA As Integer
Dim TotalB As Integer
Dim TotalC As Integer
Dim CheckA As String
Dim CheckB As String
Dim CheckC As String
StartLevel = Me.txtStartLevel.Value
FinishLevel = StartLevel + Me.txtNoOfLevels.Value - 1
For a = StartLevel To FinishLevel
CheckA = "chkLevela" & Format$(a)
If Me(CheckA) Then
TotalA = TotalA + 1
End If
Next a
For b = StartLevel To FinishLevel
CheckB = "chkLevelb" & Format$(b)
If Me(CheckB) Then
TotalB = TotalB + 1
End If
Next b
For c = StartLevel To FinishLevel
CheckC = "chkLevelc" & Format$(c)
If Me(CheckC) Then
TotalC = TotalC + 1
End If
Next c
Note that you are making it a little more difficult that it need be. The
following could replace what you already have:
Dim ctlCurr As Control
Dim intLoop As Integer
Dim StartLevel As Integer
Dim FinishLevel As Integer
StartLevel = Me.txtStartLevel.Value
FinishLevel = StartLevel + Me.txtNoOfLevels.Value - 1
For intLoop = StartLevel To FinishLevel
Set ctlCurr = Me.Controls("chkLevela" & Format$(intLoop))
ctlCurr.Enabled = False
ctlCurr.Visible = False
Set ctlCurr = Me.Controls("chkLevelb" & Format$(intLoop))
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=12486
ctlCurr.Enabled = False
ctlCurr.Visible = False
Set ctlCurr = Me.Controls("chkLevelc" & Format$(intLoop))
ctlCurr.Enabled = False
ctlCurr.Visible = False
Next intLoop
and what I suggested could be
Dim intLoop As Integer
Dim intTotalA As Integer
Dim intTotalB As Integer
Dim intTotalC As Integer
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=12486
Dim StartLevel As Integer
Dim FinishLevel As Integer
StartLevel = Me.txtStartLevel.Value
FinishLevel = StartLevel + Me.txtNoOfLevels.Value - 1
For intLoop = StartLevel To FinishLevel
intTotalA = intTotalA + IIf(Me.Controls("chkLevela" & Format$(intLoop)),
1, 0)
intTotalB = intTotalB + IIf(Me.Controls("chkLevelb" & Format$(intLoop)),
1, 0)
intTotalC = intTotalC + IIf(Me.Controls("chkLevelc" & Format$(intLoop)),
1, 0)
Next intLoop
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)
"Barry"
wrote in message
news:E8F1BB1F-2C28-414D-8EC6-D50F63FE98AA@microsoft.com...
>I have a form which makes check boxes visible depending on a value selected
> by the user as a start and finish value. the check boxes are split into
> colums from A-C and in rows from 0-30. This works fine but what i now need
> to
> do is count all the check boxes ticked in column A and a count of all the
> check boxes ticked in column B etc..
>
> can anyone please please help me with this??
>
> Here is the code i have used to make the check boxes visible
>
> Dim a As Integer
> Dim b As Integer
> Dim c As Integer
> Dim CheckA As String
> Dim CheckB As String
> Dim CheckC As String
>
> StartLevel = Me.txtStartLevel.Value
> FinishLevel = StartLevel + Me.txtNoOfLevels.Value - 1
>
> For a = StartLevel To FinishLevel
> CheckA = "chkLevela" & Format$(a)
> Me(CheckA).Enabled = False
> Me(CheckA).Visible = False
> Next a
>
> For b = StartLevel To FinishLevel
> CheckB = "chkLevelb" & Format$(b)
> Me(CheckB).Enabled = False
> Me(CheckB).Visible = False
> Next b
>
> For c = StartLevel To FinishLevel
> CheckC = "chkLevelc" & Format$(c)
> Me(CheckC).Enabled = False
> Me(CheckC).Visible = False
> Next c