Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Counting checkbox with criteria ??

Status
Not open for further replies.

pookie62

Technical User
Oct 22, 2004
139
GB
Hi All,
I'm new on this forum and can't get my thing done..
I've checkbox on a Form with this property:
=IIf([NR]>0;Waar;Onwaar)
So, if NR is greater then zero, the box get's checked.
How do I count the boxes that are checked ??
I can't get it done....

Thanks for replying !
Hans
 
How many of these checkboxes do you have on your form?
Where do you want to count them? As a subtotal on the form?
 

lupins46,

Why dont you just query the recordset containing [NR] and count how many are greater than 0?

Mordja
 
How are ya snahpookie . . . . .

Try:
Code:
[blue] =DCount("[[purple][b]PrimaryKeyName[/b][/purple]]", "[purple][b]TableName[/b][/purple]", "[[purple][b]CheckBoxName[/b][/purple]] = True")[/blue]

Calvin.gif
See Ya! . . . . . .
 
Hi Lupins46 !
Thanks for replying !
The amount differs, it depends on how many competitors I have on a contest. We have several contests in a year.

I want to display how many of the contestors are not members for this particular contest.
(Members do have this number I'm refering to in the original post)
Does this make sence ?
Greetz
Hans
 
Hello again,
Thanks all, but I don't want to count all from a table, just from the Form I'm in.
I have a total (competitors) and want to count how many of them don't have this NR. (Where the checkbox isn't checked) But only for records shown on this Form !
Thanks again...
(This is a great Forum though !!)
:)
 
Not sure whether it is the checked (>0) or the unchecked (=0) you're counting, but

For checked try:
[tt]=abs(sum([NR]>0))[/tt]
For unchecked try:
[tt]=abs(sum([NR]=0))[/tt]

Roy-Vidar
 
Thanks RoyVidar,
This helps me on the road..
I changed the code to :
=Abs(Aantal([NR]=Waar))

It does count now, but it count's all checked records !
And whatever criteria I set e.g.
=Abs(Aantal([NR]=Onwaar))
=Abs(Aantal([NR]=0))
=Abs(Aantal([NR]=1))
=Abs(Aantal([NR]=-1))
It keeps counting all checked records ...?!?
Rather confusing to me !!

Any ideas ?
 
The sum function works on the current recordsource of the form. If the form contains all records, then all records are included. If it contains a filter, it will sum (count) from the filtered records.

I cannot replicate what you have. It works correct on my setup, what heppens if you refresh the form (navigate back and forth between records?) What datatype is NR, what datatype are Onwaar and Waar...

Roy-Vidar
 
Refershing makes no difference
NR is a numeric value in the table.
Waar = True
Onwaar = False
Sorry for not translating.. :) (Dutch)

Unless you can provide something else, I could leave it this way..
Thanks again !!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top