Access 2000 data type conversion error or seeking correct syntax

33 Views Asked by At

SQL stmt:

SELECT TOP 5 col1, col2, Format(col3with$text,"#,##0.00") AS Expr1
FROM myTBL

produces results as expected

but SQL stmt:

SELECT TOP 5 col1, col2, Format(col3with$text,"#,##0.00") AS Expr1
FROM myTBL
WEHRE Format(col3with$text,"#,##0.00") > 0

produced syntax error

what's the correct syntax? Thanks.

1

There are 1 best solutions below

0
Andre On

1 - It's WHERE, not WEHRE.

2 - Format() returns a string, you can't compare this with > 0.

Converting to Currency is probably better:

WHERE CCur([col3with$text]) > 0

3 - SELECT TOP 5 makes little sense without an ORDER BY clause.