473,387 Members | 3,684 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Count problem

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
7 1877
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
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
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
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
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
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


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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Kong Li | last post by:
Follow up to this thread, the latest Oracle 9i release 2 patchset (9.2.0.5) fixed the handle count leak problem. The problem is in Oracle client component. Thanks. Kong ----- From: Kong...
3
by: rob.guitar.rob | last post by:
Hello, My last few posts have been revolving aroung the same problem, and I still cant solve it and I would be really appreciate if anyone could spot a problem. a section of my XML goes like...
1
by: Irfan | last post by:
Hello, I am having some problem with count function. I have a report in which has grouping by a person wise and sub grouping in invoied status e.g.. the output will be Irfan Records (First...
8
by: Invalidlastname | last post by:
Hi, We are developing an asp.net application, and we dynamically created certain literal controls to represent some read-only text for certain editable controls. However, recently we found an issue...
8
by: novus | last post by:
Hi, In ASP.net 2.0 I make a control which add the same controls dynamically. In the oninit event I add the controls to the controls collection. After that the loadviewstate event fills in the...
68
by: Martin Joergensen | last post by:
Hi, I have some files which has the following content: 0 0 0 0 0 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 0 0 0 0 0 0 0
4
by: Igor | last post by:
I have one SELECT statement that needs to return one ntext field from one table and count something from other table, problem is that all fileds that are not in count have to be in group by and...
23
by: Gary Wessle | last post by:
Hi I have a vector<charwhich looks like this (a d d d a d s g e d d d d d k) I need to get the biggest count of consecutive 'd'. 5 in this example I am toying with this method but not sure if...
22
by: MP | last post by:
vb6,ado,mdb,win2k i pass the sql string to the .Execute method on the open connection to Table_Name(const) db table fwiw (the connection opened via class wrapper:) msConnString = "Data Source="...
4
by: haresh.amis | last post by:
hello to all, I m using .net 2.0 and i face a problem that is as under Well I have a checkboxlist which i bound in .cs page now I want to count that how many checkboxes ate checked ( In...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.