Check Box

G

Guest

I have a check box on my form that i will select if per say is a "ding". when
I ran a report i would like to count how many "dings" I had for the month.
How can I do that? If I use the "count" function only give the total records
(even if the ding check box is not selected). I want to count only the
selected ding check box. Thank you.
 
F

fredg

I have a check box on my form that i will select if per say is a "ding". when
I ran a report i would like to count how many "dings" I had for the month.
How can I do that? If I use the "count" function only give the total records
(even if the ding check box is not selected). I want to count only the
selected ding check box. Thank you.

Add an unbound text control to the report.
Set it's control source to:
=Abs(Sum([CheckFieldName]))
 
G

Guest

Great! it did work, thanks a lot FREDG.
Now, I am using the same argument in the control source for another
database, where the field name is "Pass/Fail" and I want to count and list
how namy has failed, but it is not working any idea why?

Thanks again.



fredg said:
I have a check box on my form that i will select if per say is a "ding". when
I ran a report i would like to count how many "dings" I had for the month.
How can I do that? If I use the "count" function only give the total records
(even if the ding check box is not selected). I want to count only the
selected ding check box. Thank you.

Add an unbound text control to the report.
Set it's control source to:
=Abs(Sum([CheckFieldName]))
 
G

Guest

Just for the heck of it I created several versions of the count checkbox
statement for a db that stores data about outdoor enthusiasts.

The table has 1093 records, of which 52 are checked as being rifle
enthusiasts. You can substitute the name of your checkbox for "Rifle" to
count in your db.

Number of Rifle Enthusiasts =Abs(Sum([Rifle])) yields 52
Number of Rifle Enthusiasts =Abs(Sum([tblMembers]![Rifle]) yields 52
Number of Rifle Enthusiasts =Sum(IIf([Rifle]=False,0,1)) yields 52
Number of Rifle Enthusiasts =Sum(IIf([Rifle]=True,1,0)) yields 52
Negative of Number of Rifle Enthusiasts =Sum(IIf([Rifle]) yields -52

Number Not Rifle Enthusiasts =Sum(IIf([Rifle]=False,1,0)) yields 1041
Number Not Rifle Enthusiasts =Sum(IIf([Rifle]=True,0,1)) yields 1041

Total Members =Sum(IIf([Rifle]=True,1,1)) yields 1093
Total Members =Sum(IIf([Rifle]=False,1,1)) yields 1093
Total Members =Count([Rifle]) yields 1093

Number no data =Sum(IIf([Rifle]=True,0,0)) yields 0 indicating invalid
statement
Number no data =Sum(IIf([Rifle]=False,0,0)) yields 0
again the statement is invalid


LDN

vaa571 said:
Great! it did work, thanks a lot FREDG.
Now, I am using the same argument in the control source for another
database, where the field name is "Pass/Fail" and I want to count and list
how namy has failed, but it is not working any idea why?

Thanks again.



fredg said:
I have a check box on my form that i will select if per say is a "ding". when
I ran a report i would like to count how many "dings" I had for the month.
How can I do that? If I use the "count" function only give the total records
(even if the ding check box is not selected). I want to count only the
selected ding check box. Thank you.

Add an unbound text control to the report.
Set it's control source to:
=Abs(Sum([CheckFieldName]))
 
F

fredg

Great! it did work, thanks a lot FREDG.
Now, I am using the same argument in the control source for another
database, where the field name is "Pass/Fail" and I want to count and list
how namy has failed, but it is not working any idea why?

Thanks again.

fredg said:
I have a check box on my form that i will select if per say is a "ding". when
I ran a report i would like to count how many "dings" I had for the month.
How can I do that? If I use the "count" function only give the total records
(even if the ding check box is not selected). I want to count only the
selected ding check box. Thank you.

Add an unbound text control to the report.
Set it's control source to:
=Abs(Sum([CheckFieldName]))

How would you expect the same calculation that counts Yes responses to
count the No responses?

To count No's:
=Sum([CheckName] = 0,1,0)
 
G

Guest

Fred,

If I needed to do so, I would concatenate two of my statements like this:

="Enthusiasts= " & Sum(IIf([Rifle]=False,0,1)) & " Not Enthusiasts = " &
Sum(IIf([Rifle]=True,0,1))

LDN

fredg said:
Great! it did work, thanks a lot FREDG.
Now, I am using the same argument in the control source for another
database, where the field name is "Pass/Fail" and I want to count and list
how namy has failed, but it is not working any idea why?

Thanks again.

fredg said:
On Fri, 6 Jul 2007 09:42:01 -0700, vaa571 wrote:

I have a check box on my form that i will select if per say is a "ding". when
I ran a report i would like to count how many "dings" I had for the month.
How can I do that? If I use the "count" function only give the total records
(even if the ding check box is not selected). I want to count only the
selected ding check box. Thank you.

Add an unbound text control to the report.
Set it's control source to:
=Abs(Sum([CheckFieldName]))

How would you expect the same calculation that counts Yes responses to
count the No responses?

To count No's:
=Sum([CheckName] = 0,1,0)
 
F

fredg

Fred,

If I needed to do so, I would concatenate two of my statements like this:

="Enthusiasts= " & Sum(IIf([Rifle]=False,0,1)) & " Not Enthusiasts = " &
Sum(IIf([Rifle]=True,0,1))

LDN

fredg said:
Great! it did work, thanks a lot FREDG.
Now, I am using the same argument in the control source for another
database, where the field name is "Pass/Fail" and I want to count and list
how namy has failed, but it is not working any idea why?

Thanks again.

:

On Fri, 6 Jul 2007 09:42:01 -0700, vaa571 wrote:

I have a check box on my form that i will select if per say is a "ding". when
I ran a report i would like to count how many "dings" I had for the month.
How can I do that? If I use the "count" function only give the total records
(even if the ding check box is not selected). I want to count only the
selected ding check box. Thank you.

Add an unbound text control to the report.
Set it's control source to:
=Abs(Sum([CheckFieldName]))

How would you expect the same calculation that counts Yes responses to
count the No responses?

To count No's:
=Sum([CheckName] = 0,1,0)

Doesn't look correct to me!

1) If the value of [Rifle] is False, the statement
IIf([Rifle] = False, will evaluate as True, so you need to add 1 to
the True part of the statement, not the False part.
It's really not as confusing as it sounds.


2) If [Rifle] = True, then (to count using the above method)
IIf([Rifle] = True, will evaluate as True, so you need to add 1 in the
True part of the statement.
=IIf([Rifle] = True,1,0)

2a) Or you could use Abs(Sum([Rifle]))

3) Try either:

="Enthusiasts= " & Sum(IIf([Rifle]=False,1,0)) & " Not Enthusiasts =
" & Sum(IIf([Rifle]=True,1,0))

or..

="Enthusiasts= " & Abs(Sum([Rifle])) & " Not Enthusiasts = " &
Sum(IIf([Rifle]=False,1,0))
 
G

Guest

So do you agree that one statement can be written to count yeses and nos, and
-1s and 0s?

The true number that my machine computes may be differently than yours
because it drops and add bits for no apparent reason in this rarified air.

LDN


fredg said:
Fred,

If I needed to do so, I would concatenate two of my statements like this:

="Enthusiasts= " & Sum(IIf([Rifle]=False,0,1)) & " Not Enthusiasts = " &
Sum(IIf([Rifle]=True,0,1))

LDN

fredg said:
On Fri, 6 Jul 2007 11:06:02 -0700, vaa571 wrote:

Great! it did work, thanks a lot FREDG.
Now, I am using the same argument in the control source for another
database, where the field name is "Pass/Fail" and I want to count and list
how namy has failed, but it is not working any idea why?

Thanks again.

:

On Fri, 6 Jul 2007 09:42:01 -0700, vaa571 wrote:

I have a check box on my form that i will select if per say is a "ding". when
I ran a report i would like to count how many "dings" I had for the month.
How can I do that? If I use the "count" function only give the total records
(even if the ding check box is not selected). I want to count only the
selected ding check box. Thank you.

Add an unbound text control to the report.
Set it's control source to:
=Abs(Sum([CheckFieldName]))
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail


How would you expect the same calculation that counts Yes responses to
count the No responses?

To count No's:
=Sum([CheckName] = 0,1,0)

Doesn't look correct to me!

1) If the value of [Rifle] is False, the statement
IIf([Rifle] = False, will evaluate as True, so you need to add 1 to
the True part of the statement, not the False part.
It's really not as confusing as it sounds.


2) If [Rifle] = True, then (to count using the above method)
IIf([Rifle] = True, will evaluate as True, so you need to add 1 in the
True part of the statement.
=IIf([Rifle] = True,1,0)

2a) Or you could use Abs(Sum([Rifle]))

3) Try either:

="Enthusiasts= " & Sum(IIf([Rifle]=False,1,0)) & " Not Enthusiasts =
" & Sum(IIf([Rifle]=True,1,0))

or..

="Enthusiasts= " & Abs(Sum([Rifle])) & " Not Enthusiasts = " &
Sum(IIf([Rifle]=False,1,0))
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top