By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,145 Members | 1,594 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,145 IT Pros & Developers. It's quick & easy.

Count problem

P: n/a
Dear
I have a table with a Text field named "Attest". In that field I can
fill in 4 possibilities: A, B, C or D.
In a report based om that table I want to count how many times I
filled in something. With =Count([Attest]) this works perfectly.
Now I want to count how many times I filled in A (or B, ...). Whatever
I try, this doesn't work. Can anybody help me?
Thank you!
Hugo L.
Nov 13 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
Hugo,

Create a query based on your table. Pull down the Attest field and the primary
key into two query fields. Click on the Sigma button at the top of the screen to
turn the query into a totals query. Under the primary key, use the drop down
list to change Group By to Count. When you run the query, you'll get four rows.
Under Attest you'll get A, B, C, D and under the primary key you'll get the
count of A records, B records, and so on.

You can base your report on this query or create a crosstab query based on this
query and then base your report on the crosstab query.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com


"Hugo L." <hu**********@pi.be> wrote in message
news:66**************************@posting.google.c om...
Dear
I have a table with a Text field named "Attest". In that field I can
fill in 4 possibilities: A, B, C or D.
In a report based om that table I want to count how many times I
filled in something. With =Count([Attest]) this works perfectly.
Now I want to count how many times I filled in A (or B, ...). Whatever
I try, this doesn't work. Can anybody help me?
Thank you!
Hugo L.

Nov 13 '05 #2

P: n/a
On 30 May 2004 12:17:57 -0700, hu**********@pi.be (Hugo L.) wrote:
Dear
I have a table with a Text field named "Attest". In that field I can
fill in 4 possibilities: A, B, C or D.
In a report based om that table I want to count how many times I
filled in something. With =Count([Attest]) this works perfectly.
Now I want to count how many times I filled in A (or B, ...). Whatever
I try, this doesn't work. Can anybody help me?
Thank you!
Hugo L.


=Sum(IIf([Attest]="A",1,0))
=Sum(IIf([Attest]="B",1,0))
....
Nov 13 '05 #3

P: n/a
On Sun, 30 May 2004 20:17:59 GMT, "PC Datasheet" <no****@nospam.spam> wrote:
Hugo,

Create a query based on your table. Pull down the Attest field and the primary
key into two query fields. Click on the Sigma button at the top of the screen to
turn the query into a totals query. Under the primary key, use the drop down
list to change Group By to Count. When you run the query, you'll get four rows.
Under Attest you'll get A, B, C, D and under the primary key you'll get the
count of A records, B records, and so on.

You can base your report on this query or create a crosstab query based on this
query and then base your report on the crosstab query.


This answer and my answer are equally right in different situations. PCD's
answer (above) is more robust, though, because it will always report counts of
all answers, even if new ones appear in the data later on.

The answer I gave in my other reply is useful if you need to group the query
by some other field, and get sums of each answer value on each group row.
Nov 13 '05 #4

P: n/a
Dear Steve
Thank you for helping me!
However, it doesn't work. I copied your expression
=Sum(IIf([Attest]="A",1,0))in my textfield on the report. I get a
message that the expression is invalid. Can you explain why?
Thanks!
Hugo

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #5

P: n/a
I guess I can't. I use expressions like that one frequently with no problems.

On 31 May 2004 02:36:23 GMT, Donkey Donk <hu**********@pi.be> wrote:
Dear Steve
Thank you for helping me!
However, it doesn't work. I copied your expression
=Sum(IIf([Attest]="A",1,0))in my textfield on the report. I get a
message that the expression is invalid. Can you explain why?
Thanks!
Hugo

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Nov 13 '05 #6

P: n/a
References problem, perhaps?

Don
"Steve Jorgensen" <no****@nospam.nospam> wrote in message
news:1v********************************@4ax.com...
I guess I can't. I use expressions like that one frequently with no problems.
On 31 May 2004 02:36:23 GMT, Donkey Donk <hu**********@pi.be> wrote:
Dear Steve
Thank you for helping me!
However, it doesn't work. I copied your expression
=Sum(IIf([Attest]="A",1,0))in my textfield on the report. I get a
message that the expression is invalid. Can you explain why?
Thanks!
Hugo

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 13 '05 #7

P: n/a


Dear
The problem is solved: since I use a Dutch version of Access, "Sum" must
be changed intO"Som".
With =Som(IIf([Attest]="A",1,0)) it works perfectly!
Thanks for you r help!
Hugo

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.