IF expression in Acces 2003

R

ReportTrouble

=Sum(IIf([Click Count]="1",1,0))

But What I need it 1=1, 2=2, 3=3 and so on however it does not let me put
that many conditions....

I am trying to do a Count in a report
 
J

John W. Vinson

=Sum(IIf([Click Count]="1",1,0))

But What I need it 1=1, 2=2, 3=3 and so on however it does not let me put
that many conditions....

I am trying to do a Count in a report

Are you in fact storing a *count* in a Text field? Why?
Are the values of [Click Count] in fact all numbers (in a text field)? If so
you can just use

=Sum(Val([Click Count]))

The Val function will convert any text string that starts with a number to the
number - e.g. Val("1") is 1, Val("3COM") is 3, Val("3.14159") is 3.14159. If
it doesn't start with a number it returns 0 (e.g. Val("x35") is 0.
 
M

M Skabialka

Try this:
=Sum(Nz(Val([Click Count]), 0))

assuming that [Click Count] is a string.
 
K

KC-Mass

Something on the order of :

=Sum(IIf([Click Count]="1",1,IIf([ClickCount]="2",2,IIf([ClickCount] =
"3",0))))

etc.

Regards

Kevin
 

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

Similar Threads

Access count a field in access report 2
Count Function 6
Trying to Count in a Report 3
IIf expression help needed 5
IIf for individual record 6
Count Query 3
Expression in query 2
Complex SQL 1

Top