IF expression in Acces 2003

  • Thread starter Thread starter ReportTrouble
  • Start date Start date
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
 
=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.
 
Something on the order of :

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

etc.

Regards

Kevin
 
Back
Top