Format query column as number

  • Follow


I am trying to use a >6 in my query criteria but it is not working.  I 
suspect the problem is values in the column are not numbers.  This query 
comes from another query where values are extracted from a string. Is there 
a way to format the column of a query to a "NUMBER"? 


0
Reply Jeff 7/23/2007 2:12:41 PM

If the field is named Field1, try:
    Val(Nz([Field1],"0"))

The Val() gives the numeric value of a string. It can't cope with Null, so 
we convert the nulls to a string zero first.

-- 
Allen Browne - Microsoft MVP.  Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Jeff Klein" <jklein@nospam> wrote in message
news:OWc$IOTzHHA.4928@TK2MSFTNGP03.phx.gbl...
>I am trying to use a >6 in my query criteria but it is not working.  I 
>suspect the problem is values in the column are not numbers.  This query 
>comes from another query where values are extracted from a string. Is there 
>a way to format the column of a query to a "NUMBER"? 

0
Reply Allen 7/23/2007 2:41:01 PM


Jeff Klein wrote:

>I am trying to use a >6 in my query criteria but it is not working.  I 
>suspect the problem is values in the column are not numbers.  This query 
>comes from another query where values are extracted from a string. Is there 
>a way to format the column of a query to a "NUMBER"? 


Use a conversion function such as Val, CLng, etc. to make
the field a number:

Expr1:  CLng(somefield)

-- 
Marsh
MVP [MS Access]
0
Reply Marshall 7/23/2007 3:01:01 PM

2 Replies
1251 Views

(page loaded in 0.039 seconds)


Reply: