hi,
perhaps this is along the same lines...
i have two forms, the main form and its subform. the
subform is being displayed as a continuous datasheet (oh
yeah and btw i am using A2K), and i want the color of
the 'Time_on_List' control to change from black test on
white bkgrnd to yellow text on red whenever its value is
= 30 and the value of an adjacent control on the same
subform's = "Pending".
for some reason the same VBA code works on other forms (in
Form view) which are not subforms but are viewed by the
user as a main form but it has no effect on the same
control when applied in the context i've just described.
my code is below, can you point to some obvious glitch?
Private Sub Form_Current()
Dim lngRed As Long, lngYellog As Long, lngWhite As Long,
Time_on_List As Integer
lngRed = RGB(255, 0, 0)
lngBlack = RGB(0, 0, 0)
lngYellow = RGB(255, 255, 0)
lngWhite = RGB(255, 255, 255)
Me.Time_on_List = DateDiff("d", Me.Date_on_List, Now())
If Me.Time_on_List >= 30 And Me.Outcome = "Pending" Then
Me.Time_on_List.ForeColor = lngYellow
Me.Time_on_List.BackColor = lngRed
Else
Me.Time_on_List.ForeColor = lngBlack
Me.Time_on_List.BackColor = lngWhite
End If
End Sub
-----Original Message-----
Thanks Dirk. You have provided me another reason to
upgrade from Access97. In the meantime, do you know of
another route to accomplish this in Access97?
Lloyd
-----Original Message-----
The following code works to show "late" dates in a
different color on a single record form. Is there an easy
way to do it on a continuous form?
Thanks, Lloyd
Private Sub Form_Current()
If Me![NextActionDate] < Date Then
Me![NextActionDate].ForeColor = vbGreen
Me![NextActionDate].BackColor = vbBlue
Else
Me![NextActionDate].ForeColor = vbBlue
Me![NextActionDate].BackColor = vbWhite
End If
End Sub
You'd have to use the conditional formatting feature instead. That
should be available if you are running Access 2000 or later.
In design view, set the properties of [NextActionDate] the way you want
them to be normally (if the value is *not* < Date), then with that
control selected click Format -> Conditional Formatting..., set the
condition for "Field Value Is", "less than", "Date()", and pick the
ForeColor and BackColor properties you want to apply.
--
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)
.
.