H
Hilary Ostrov
I have been using code to alert user to changes that need to be made
to a record under certain conditions in Form Current.
CL_Type can be either Adult or Child. The following *was* working
(along with other events and If statements in Form Current):
'unbound txtbox to display current age on form
Me.txtAge = "Age " & DateDiff("yyyy", [CL_DOB], Date) -
IIf(Format([CL_DOB], "mmdd") > Format(Date, "mmdd"), 1, 0)
If Me.txtAge > 18 And Me.CL_ARCode Like "C*" Then
Me.CL_ARCode.BackColor = "255"
MsgBox "Please change 'C' in AR Code to 'A' and make sure 'Client
Type' is 'Adult'", vbOKOnly
Else: Me.CL_ARCode.BackColor = "16777215"
End If
There was one Child record previously, and above worked as expected.
But, now that I've appended all the "Child" records, the MsgBox pops
up and BackColor changes *regardless* of Child's txtAge. Adult
records are still fine and even Child records appear as expected after
hitting OK.
So I've tried various modifications - with no success - including
(most recently):
Dim stClientType As String
stClientType = "Child"
If Me.txtAge.Value > 18 And Me.CL_Type = stClientType Then
Me.CL_ARCode.BackColor = "255"
MsgBox "Please change 'C' in AR Code to 'A' and make sure 'Client
Type' is 'Adult'", vbOKOnly
Else: Me.CL_ARCode.BackColor = "16777215"
End If
<sigh> If someone would be good enough to show me the error of my
ways, I'd be eternally grateful
Thanks.
hro
to a record under certain conditions in Form Current.
CL_Type can be either Adult or Child. The following *was* working
(along with other events and If statements in Form Current):
'unbound txtbox to display current age on form
Me.txtAge = "Age " & DateDiff("yyyy", [CL_DOB], Date) -
IIf(Format([CL_DOB], "mmdd") > Format(Date, "mmdd"), 1, 0)
If Me.txtAge > 18 And Me.CL_ARCode Like "C*" Then
Me.CL_ARCode.BackColor = "255"
MsgBox "Please change 'C' in AR Code to 'A' and make sure 'Client
Type' is 'Adult'", vbOKOnly
Else: Me.CL_ARCode.BackColor = "16777215"
End If
There was one Child record previously, and above worked as expected.
But, now that I've appended all the "Child" records, the MsgBox pops
up and BackColor changes *regardless* of Child's txtAge. Adult
records are still fine and even Child records appear as expected after
hitting OK.
So I've tried various modifications - with no success - including
(most recently):
Dim stClientType As String
stClientType = "Child"
If Me.txtAge.Value > 18 And Me.CL_Type = stClientType Then
Me.CL_ARCode.BackColor = "255"
MsgBox "Please change 'C' in AR Code to 'A' and make sure 'Client
Type' is 'Adult'", vbOKOnly
Else: Me.CL_ARCode.BackColor = "16777215"
End If
<sigh> If someone would be good enough to show me the error of my
ways, I'd be eternally grateful
Thanks.
hro