[AccessD] Form Validation

Ryan W wrwehler at gmail.com
Sat Oct 29 19:06:37 CDT 2022


VarChar was to be able use string literals such as "White" as well as maybe
the #FFF style color codes, rather than RGB(0,0,0) style. This was all just
pseudocode to get the gist of what I'm wanting.
As for ClientID being a key, it is what it is. Inherited DB and all.



I'll have to write this up Monday when I'm actually in a VB Editor.





On Sat, Oct 29, 2022 at 6:07 PM Stuart McLachlan <stuart at lexacorp.com.pg>
wrote:

> First impression:
>  Colours are 4byte integers (LONGs) (with the top byte unused for RGB
> colours)
> (And Project and Client keys as varchars() is a bit on the nose too :) )
>
> That said - Eval doesn't recognise "me".
> You'll need to do something like:
>
> 'Record in table:
> FieldToScrutinize "ExtraFld1"
> FunctiomToEval = "Len(<fldval>) > 0"
>
> Then in your function
> 'Create Eval string
> strFldVal = Me(strFld)
> strEval = Replace(rst.FunctionToEval, "<fldval>", rst.FieldToScrutinize)
> If Eval(strEval) ....
>
>
>
>
>
> On 29 Oct 2022 at 16:48, Ryan W wrote:
>
> > I thought I had emailed about this before but I cannot find it.  Maybe
> > it got lost somewhere along the way or I thought about emailing and
> > never did.
> >
> > I've got a form we use to log in client data, there are some extra
> > fields that are NOT required by every client so I can't put backend
> > constraints on them.
> >
> > I was wondering if I could write a table such as:
> >
> > ClientID varchar(100)
> > Project varchar(100)
> > FieldToScrutinize varchar(100)
> > FunctionToEval varchar(255)
> > ForeColor varchar(50)
> > BackColor varchar(50)
> >
> >
> > So lets say we have ClientA, Project B, FieldToScrutinize is
> > "ExtraFld1"
> >
> > FunctionToEval would be something like Len(me!extrafld1) = 0
> >
> > So then in the form code we have something like
> >
> > rst = currentdb.openrecordset("SELECT * FROM ValidationRules WHERE
> > ClientID = '" & me.ClientID & "'")
> >
> > do until rst.eof
> >    if Eval(rst!FunctionToEval) = false then
> >   me(FieldToScrutinize).BackColor = rst!BackColor
> >   me(FieldToSTrutinize).ForeColor = rst!ForeColor
> >    end if
> > rst.MoveNext
> > loop
> >
> > I guess my question is, will EVAL work in that manner?  That way all
> > my validation rules for these specific clients can be managed in a
> > table rather than adding code and having to distribute a new FE when
> > rules are modified? -- 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