[AccessD] Form Validation

Stuart McLachlan stuart at lexacorp.com.pg
Sat Oct 29 21:26:26 CDT 2022


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
> 




More information about the AccessD mailing list