[AccessD] Form Validation

Stuart McLachlan stuart at lexacorp.com.pg
Sat Oct 29 19:52:23 CDT 2022


On 29 Oct 2022 at 19:23, Ryan W wrote:

> By the way:
> 
> I did just test Eval(Len(Me!Field)>0) in a little test DB here at home
> and it did spit out the right result, so it does seem even though Eval
> may not know about the "Me" object, Len still does.
> 

Naturally Len() does, because you are passing it a string (the content of Me!Field).
The compiler first gets the content of Me!Field  and stores it as a string. something like 
"abc"
It then  calculates the value of Len("abc") and stores it as number - 3 in this case.
It then compare 3 to 0 and stores a boolena value - True (-1)  in this case.
It then passes that Boolean value to EVAL()
i.e. the compiler calculates  EVAL(-1) which returns -1.

EVAL() is a totally different thing. All it can work with are values and operators. It knows 
nothing about Object models such as Forms and controls. .

If you try  Eval("Len(Me!Field)>0") it will tell you it doesn't understand what it has been 
given.


More information about the AccessD mailing list