Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: re:Counting check boxes on a report


Message #1 by Brian Skelton <brian_skelton@o...> on Wed, 28 Feb 2001 23:44:22 -0000
Peter



Something along these lines should work...



Create a text box in the detail section of your report called 'txtNoOfTicks'



Create an event procedure for the On Format event of the detail section and put the following code in it:



Me![txtNoOfTicks] = CountTicks(Me,acDetail)



Create this function either on the report or in a module:



Function CountTicks(rpt As Report,Sect as Integer) As Integer

Dim ctrl As Control

Dim count As Integer



For Each ctrl In rpt.Section(Sect).Controls

    If ctrl.ControlType = acCheckBox Then

        If ctrl.Value Then

            count = count + 1

        End If

    End If

Next

countticks = count

End Function



It cycles through all the controls in the section, and for those that are tick boxes, checks the value stored in the tick box.



Brian


  Return to Index