IIf expresion

  • Thread starter CharlesCount via AccessMonster.com
  • Start date
C

CharlesCount via AccessMonster.com

I have a field in table that is formatted as text and contain info like
"XL01", "XL01" etc. "STBY01" "STBY02" etc and numbers that are greater than
40000 I would like to slect theffield conatain the number and count them,
such as if the field contain >4000,1.0 but becuase the fileld is text the
expression is not working, is there a way to make it work?

CharlesCount
 
K

Ken Snell \(MVP\)

Can you post more detailed examples of the data and show which ones should
be counted and which ones should not? Does the field actually contain this
value:

and you want to count that because it contains a number greater than or
equal to 4000?

Is this to be done within a textbox on the form?
 
B

Bob Quintal

I have a field in table that is formatted as text and contain info
like "XL01", "XL01" etc. "STBY01" "STBY02" etc and numbers that
are greater than 40000 I would like to slect theffield conatain
the number and count them, such as if the field contain >4000,1.0
but becuase the fileld is text the expression is not working,
is there a way to make it work?

CharlesCount
in your query, use an expression to convert your text field to a
number, using the val() function:
sum(iif(val([numberAsStringField])>4000,1,0)
 
C

CharlesCount via AccessMonster.com

Thanks

Bob said:
I have a field in table that is formatted as text and contain info
like "XL01", "XL01" etc. "STBY01" "STBY02" etc and numbers that
[quoted text clipped - 4 lines]
CharlesCount

in your query, use an expression to convert your text field to a
number, using the val() function:
sum(iif(val([numberAsStringField])>4000,1,0)
 
Top