R
Richard John
I am trying to enforce some form rules in MS access 2003. The approach that works at present is the
"hard-coded" one like this:
......
If (IsNull([Placement date])) Then
lblAlertPlacementDate.Visible = True
alerts = vbTrue
End If
If (IsNull([SiblingGroup])) Then
lblAlertSibgroup.Visible = True
alerts = vbTrue
End If
..... blah..
There are some 20 such rules to enforce. So I am trying an automated way using ADO (or is it DAO ..
could never get that right .. ) where a list of enfordeable fields is read from a table. The
result is this code:
' Called from OnClose event of the 'Reception Intake form'
' Mandatory fields are checked against fields marked as 'mandatory'
' in "tblMandatoryFields"
Set db = CurrentDb
SQL = "select Fieldname,AlertIcon from tblMandatoryFields where flag=" & vbTrue
Set rsMand = db.OpenRecordset(SQL, dbOpenDynaset)
Do Until rsMand.EOF
sAlertIcon = rsMand("AlertIcon")
sFieldname = rsMand("Fieldname")
If IsNull(sFieldname) Or Len(Nz(sFieldname, "")) = 0 Then
rsMand("AlertIcon").Visible = True
alerts = vbTrue
End If
rsMand.MoveNext
Loop
If the field has not been completed, a red alert box (rsMand("AlertIcon")) appears adjacent to the
field.
Can't get this to work. It is not accepting this line of code
*** rsMand("AlertIcon").Visible ***
Any ideas please? This approach is better for my purposes where it gives the manager the ability to
specify which fields to enforce from a form provided for just this purpose.
Thanks
"hard-coded" one like this:
......
If (IsNull([Placement date])) Then
lblAlertPlacementDate.Visible = True
alerts = vbTrue
End If
If (IsNull([SiblingGroup])) Then
lblAlertSibgroup.Visible = True
alerts = vbTrue
End If
..... blah..
There are some 20 such rules to enforce. So I am trying an automated way using ADO (or is it DAO ..
could never get that right .. ) where a list of enfordeable fields is read from a table. The
result is this code:
' Called from OnClose event of the 'Reception Intake form'
' Mandatory fields are checked against fields marked as 'mandatory'
' in "tblMandatoryFields"
Set db = CurrentDb
SQL = "select Fieldname,AlertIcon from tblMandatoryFields where flag=" & vbTrue
Set rsMand = db.OpenRecordset(SQL, dbOpenDynaset)
Do Until rsMand.EOF
sAlertIcon = rsMand("AlertIcon")
sFieldname = rsMand("Fieldname")
If IsNull(sFieldname) Or Len(Nz(sFieldname, "")) = 0 Then
rsMand("AlertIcon").Visible = True
alerts = vbTrue
End If
rsMand.MoveNext
Loop
If the field has not been completed, a red alert box (rsMand("AlertIcon")) appears adjacent to the
field.
Can't get this to work. It is not accepting this line of code
*** rsMand("AlertIcon").Visible ***
Any ideas please? This approach is better for my purposes where it gives the manager the ability to
specify which fields to enforce from a form provided for just this purpose.
Thanks