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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

=Count(IIf([ works for one field, but not another 1

Status
Not open for further replies.

Correenie

Technical User
Feb 28, 2007
9
US
Please help if you can.

=Count(IIf([His Age]<"31" And [His Age]>"1",1))/Count([His Age])

works fine for giving me the percentage of people who are 30 and under, but

=Count(IIf([Combined Income]<"70000" And [Combined Income]>"1",1))/Count([Combined Income])

will not work (in the same report off the same query).

Please advise.
 
What about if you remove the quotes
Code:
=Count(IIf([Combined Income]<70000 And [Combined Income]>1,1))/Count([Combined Income])
If the field is a numeric, quotes should not be used.

Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
Thank you for your reply. I tried it without the quotes, still no luck. I have the same data as both Text and Number. Any other ideas?
 
IIf() should always have 3 arguments and you are using only 2. I would expect [Combined Income] is numeric.

Try:
=Sum(Abs([Combined Income]<70000 And [Combined Income]>1))/Count([Combined Income])



Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Thank you so much! It worked just fine! ~Correenie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top