[AccessD] Converting table data to Expression?

Jim Dettman jimdettman at verizon.net
Tue May 18 15:44:02 CDT 2021

 I do this exact type of thing.  I use a table per customer/field to
indicate if the field should be checked or not.  Then:

          ' ASN Order fields
500       OpenRecordset rsVerify, "Select * from tmp_CheckRequiredFields
Where [Level] = 'Order'"
510       If Not rsVerify.EOF Then
520           Do While Not rsVerify.EOF

530               lsShipID = Trim(rsVerify!ShipID.Value)
540               lsCurrentField = rsVerify!FieldName.Value

550               OpenRecordset rsInfo, "Select * from tbl_856OrderInfo
Where [ShipID] = '" & lsShipID & "'"
560               If Nz(rsInfo.Fields(lsCurrentField), "") <> "" Then
570                   rsVerify!Verified.Value = True
580                   rsVerify.Update
590               End If

600               rsInfo.Close
610               Set rsInfo = Nothing

620               rsVerify.MoveNext
630           Loop
640       End If

650       rsVerify.Close
660       Set rsVerify = Nothing

-----Original Message-----
From: AccessD On Behalf Of Ryan W
Sent: Tuesday, May 18, 2021 3:54 PM
To: Access Developers discussion and problem solving
<accessd at databaseadvisors.com>
Subject: [AccessD] Converting table data to Expression?

Does anyone know how to convert table data to an expression?

For example:

I want to make a table called TBL_ValidationRules



so say Client A REQUIRES Field B to be NOT NULL.

So the data would be
Client: A
Field: B

So with a button press on a form the code would loop through the recordset
for the current record/client in question and highlight or colorize Field B
if the field is null.

I can't use Table or Form validation rules for this because they change
from client to client and sometimes the end user doesn't even ENTER a field
for a validation rule to fire on it... so I was just thinking of I had a
way for my data entry people to click validate (or have it validate on
close/new record) and highlight the deficiencies that would be really cool.

So my question is how would I go about turning the text in the Eval_For
data into the expression eg:

if me(rst!Field) = rst!Eval_For then me(rst!Field).BackColor=#999999

where obviously rst!Eval_for is somehow turned into NULL (so expression
if me(rst!Field) = null then ..... .

Unless you fellas have a better idea?
AccessD mailing list
AccessD at databaseadvisors.com
Website: http://www.databaseadvisors.com

More information about the AccessD mailing list