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

Count the number of times something shows up

P: 4
On my report I have a textbox that is supppose to count how many times
a "engine shows up on the report. My code for the textbox is:
=Count([Engine Manufacturer]="BS")

But instead of just giving me the count of "BS", it give me the count
of the whole column. How or what should I do to make it do what I want
it to do.
Feb 16 '07 #1
Share this Question
Share on Google+
7 Replies


Rabbit
Expert Mod 10K+
P: 12,315
You're probably looking for:
Expand|Select|Wrap|Line Numbers
  1. DCount("[Engine Manufacturer]", "Table Name", "[Engine Manufacturer]='BS'")
Feb 16 '07 #2

P: 4
scl
You're probably looking for:
Expand|Select|Wrap|Line Numbers
  1. DCount("[Engine Manufacturer]", "Table Name", "[Engine Manufacturer]='BS'")

I got an erorr when I viewed my report
The original code I used, I wrote in the control source of the texbox properties
Feb 16 '07 #3

Rabbit
Expert Mod 10K+
P: 12,315
What's the error?

Did you change replace Table Name with your table's name?
Are the field names spelled correctly?
Feb 16 '07 #4

P: 4
scl
What's the error?

Did you change replace Table Name with your table's name?
Are the field names spelled correctly?
I used =Sum(Abs([Engine Manufacturer]="BS")) and got the answer I needed. Now I need to get the percentage of "BS" in the column. This table has 281 rows and 128 of it is "BS". I know how to do the math, but I don't know how to write to code into my textbox - property - control source. Can you please help me. Thank you.
Feb 16 '07 #5

Rabbit
Expert Mod 10K+
P: 12,315
I used =Sum(Abs([Engine Manufacturer]="BS")) and got the answer I needed. Now I need to get the percentage of "BS" in the column. This table has 281 rows and 128 of it is "BS". I know how to do the math, but I don't know how to write to code into my textbox - property - control source. Can you please help me. Thank you.
Continuing in the same vein, you could use:
Expand|Select|Wrap|Line Numbers
  1. 100*Sum(Abs([Engine Manufacturer]="BS"))/(Sum(Abs([Engine Manufacturer] Like "*")) + Sum(Abs([Engine Manufacturer] Is Null)))
Feb 16 '07 #6

P: 4
scl
Continuing in the same vein, you could use:
Expand|Select|Wrap|Line Numbers
  1. 100*Sum(Abs([Engine Manufacturer]="BS"))/(Sum(Abs([Engine Manufacturer] Like "*")) + Sum(Abs([Engine Manufacturer] Is Null)))
Thank you. It worked for me. I just change the 100 to 1 and changed my format to percent. I hope that you will be able to help me more in the future.
Feb 16 '07 #7

Rabbit
Expert Mod 10K+
P: 12,315
Not a problem. Glad to be of help.

If you changed the format then you can just get rid of the 1 altogether.
Feb 16 '07 #8

Post your reply

Sign in to post your reply or Sign up for a free account.