0
votes

simple query:

SELECT *
FROM Table
WHERE Val([TextField]) > 0;

i recevie error:

Data type mismatch in criteria expression

same in CInt \ CLng wraping.

way? or another way?

1
can you try "0" instead of 0 . - Arindam Nayak
The problem is that Val([TextField]) is causing an error because at least one value in [TextField] cannot be converted by Val. It is likely that there is some text in it that cannot be converted to a number. Investigate the IsNumeric function which will tell you whether a value is a valid number before you call Val. - Martin
@ArindamNayak same error. - dovid
@MartinParkin thank! - dovid

1 Answers

1
votes

You probably have Null values, so try this:

SELECT *
FROM Table
WHERE [TextField] Not Is Null And Val([TextField]) > 0;

or:

SELECT *
FROM Table
WHERE Val([TextField] & "") > 0;

Testing for Val([TextField]) > "0" doesn't make sense as Val returns a number.