Count Checkboxes which are ticked in a form/table/Column

I want to count all the checkboxes in a column which have been ticked.
I'v created a form, where the user will tick the checkbox, and then move on to the next record, now i want to get the total of the ticked checkboxes and display it on a form.
comicjokerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

bruintjeCommented:
Hello Comicjoker,

is this excel? since you mention column i presume the boxes are on a sheet? then this could help

Sub CountCheckedCheckboxes()
  Dim ws As Worksheet
  Dim objOLE As OLEObject
  Dim nNumChecks As Integer

  For Each ws In ThisWorkbook.Worksheets
    For Each objOLE In ws.OLEObjects
      If TypeName(objOLE.Object) = "CheckBox" Then
        If objOLE.Object.Value Then nNumChecks = nNumChecks + 1
      End If
    Next objOLE
  Next ws
  MsgBox nNumChecks
End Sub

HAGD:O)Bruintje
0
comicjokerAuthor Commented:
Its in Access, sorry I forgot to mention it.
0
bruintjeCommented:
then you could try a little count function like this

Public Function CheckCount(frm as Form) AS Integer
     dim ctl as control
    dim cc as integer

    for each ctl in frm.controls
        if typeof ctl is checkbox then cc=cc+1
    next

    CheckCount=cc
End Function

place it in a module and call it when you need to display it on a label on your form
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
comicjokerAuthor Commented:
What I did, was create a Query, with all the check boxes marked true. Then created a form based on the query, placed an edit box and in the control source typed ( =Count(*) ) which basicaly counts all the records in the query
0
bruintjeCommented:
:) that's a solution too ... thanks for the grade
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Office

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.