[AccessD] Form Validation
Ryan Wehler
wrwehler at gmail.com
Sat Oct 29 21:31:27 CDT 2022
I was thinking it had to be a string with quotes for eval to work. Like Eval(“len(blah)>0”) when I wrote that out but was wrong and yeah I forgot the bang… that’s what I get for not double checking my work when emailing. Hahaha
I’ll work it out when I’m not on a single screen device with a 14” display. It was hard to juggle my vba window, access form and gmail.. I kept getting lost trying to get the process down and communicate it back.
> On Oct 29, 2022, at 9:26 PM, Stuart McLachlan <stuart at lexacorp.com.pg> wrote:
>
> That looks workable ( with an additional "bang" between Me.Name and
> rst!FieldToScrutinize) :)
>
> Why are you wrapping z in double quotes?
>
> You could turn the actual evaluaion into a "one-liner" with
>
> IF EVAL(Replace(rst!Function, "<fldval>", _
> "Forms!" & Me.Name & "!" & rst!FieldToScrutinize)) THEN 'Evaluates to True
> ...
> ELSE 'Evaluates to False
> ...
> END IF
>
>
>> On 29 Oct 2022 at 20:24, Ryan W wrote:
>>
>> Yeah the docs mention you can use Forms!Form1!Text0 etc. I could
>> simply make the Function Len(Forms!MyForm!MyField)>0 but that locks it
>> down a bit as far as flexibility.
>>
>> I suppose I could make a string
>>
>> s = "Forms!" & Me.Name & rst!FieldToScrutinize
>>
>> z = chr(34) & Replace(rst!Function, "<fldval>", s) & chr(34)
>>
>> eval(z)
>>
>>
>> perhaps?
>>
>>
>>
>>
>>
>>
>> On Sat, Oct 29, 2022 at 8:19 PM Stuart McLachlan
>> <stuart at lexacorp.com.pg> wrote:
>>
>>>> On 30 Oct 2022 at 10:52, Stuart McLachlan wrote:
>>>
>>>> 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. .
>>>
>>> I was mistaken.
>>> It DOES know about object models. But it needs a fully qualified
>>> object reference. It just can't evaluate the reference "me".
>>>
>>> This works:
>>> 'MsgBox Eval("Len(Forms!Form1!Text0) > 0")
>>> this doesn't:
>>> MsgBox Eval("Len(Me!Text0) > 0")
>>>
>>>
>>>
>>> --
>>> AccessD mailing list
>>> AccessD at databaseadvisors.com
>>> https://databaseadvisors.com/mailman/listinfo/accessd
>>> Website: http://www.databaseadvisors.com
>>>
>> --
>> AccessD mailing list
>> AccessD at databaseadvisors.com
>> https://databaseadvisors.com/mailman/listinfo/accessd
>> Website: http://www.databaseadvisors.com
>>
>
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> https://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
More information about the AccessD
mailing list