-----Original Message-----
geoff, for the sake of posterity, i'll just quickly sum up: i have set a
Conditional Format on "Outcome" having its value displayed in Bold Yellow
with a Red Backgrnd when'er it's = "Pending".
as for the remainder, the VBA code/look i settled upon is driven with the
following:
Option Compare Database
Private Sub Form_Current()
Me.Time_on_List = DateDiff("d", Date_on_List, Now())
End Sub
Private Sub Form_Open(Cancel As Integer)
Dim fcd As FormatCondition
With Me.Time_on_List
With .FormatConditions
' ..Delete
Set fcd = .Add(acExpression, , "[Outcome]=""Pending"" And [Time_on_list]>=30")
fcd.BackColor = vbRed
fcd.ForeColor = vbYellow
fcd.FontBold = True
' End With
Set fcd = .Add(acExpression, , "[Outcome]=""Pending"" And [Time_on_list]<30")
fcd.BackColor = vbGreen
fcd.ForeColor = vbBlack
fcd.FontBold = True
End With
End With
End Sub
and i couldnadoneitwithoutya!!
bravo, well-done, you're a brainiac
all the best,
ted
:
Ted,
Intellisense will show you that you can use the FontColor
property. I guess that's what you mean by "foreground".
You're right about item b). I believe you can have up to 3
conditions for each control. Make them mutually exclusive,
otherwise Access will stop at the first true one. You're
cooking with gas!
Geof.
-----Original Message-----
by george, geoff, i think you got it that time
just a quick postmortem....
a) can i get it to give me yellow background when
Time_on_List >= 30 in
addition to the red foreground
b) does your recent code have to co-exist with the On
Current event property
code; my guess is probably so, but that only this part "
Me.Time_on_List =
DateDiff("d", Date_on_List, Now())" needs to remain
c) if i start getting creative and want to display
Time_on_List <30 with a
green foreground when Outcome = "Pending" can i toss that
into the mix
d) looks like Getz' book would be a welcome addition to
my one book Access
reference library (consisting of "Microsoft Access '97
Bible")
with best regards,
ted
:
Yeah. You commented out the Set statement!
Dump the If statement in the current event. The format
condition object is going to replace it.
Geof.
-----Original Message-----
hi geoff,
well....
here's the code i have running for "Screening Log (DS
View)" which is the
subFrm
Private Sub Form_Current()
Dim lngRed As Long
Dim lngYellow As Long
Dim lngWhite As Long
Dim lngBlack As Long
Dim 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", 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
Private Sub Form_Open(Cancel As Integer)
Dim fcd As FormatCondition
With Me.Time_on_List
With .FormatConditions
' ..Delete
' Set fcd = .Add(acExpression, , "[outcome]
=""pending""
And
' [Time_on_list]>30")
fcd.BackColor = vbRed
End With
End With
End Sub
on opening it, this results in 'Runtime Error 91'
which
means 'Object
variable or With block variable not set'.
does this mean something to you?
regards,
ted
:
Ted,
I think I have it! Thanks to Access 2000 Developer's
Handbook by Getz, Litwin, Gilbert:
Private Sub Form_Open(Cancel As Integer)
Dim fcd As FormatCondition
With Me.Time_on_List
With .FormatConditions
..Delete
Set fcd = .Add(acExpression, , "[outcome]
=""pending""
And
[Time_on_list]>30")
fcd.BackColor = vbRed
End With
End With
End Sub
Geof.
-----Original Message-----
hi,
in my case, i have a sub-form which the user views
as
a
datasheet. on it
there are three controls that are relevant.
a) Outcome
b) Date_on_List
c) Time_on_List
Time_on_List is computed on the fly for every
record
in
the underlying table.
what is desired is the following behavior, namely
when
the value of Outcome
= "Pending" and the value of "Time_on_List" >= 30
we'd
like to see the value
of "Time_on_List' displayed with a red background
using
bold yellow letters.
perhaps i ought to add the fact that using
the "Conditional Formatting"
feature of my A2K installation, i've formatted
Outcome
to
dispaly the value
in bold red letters whenever Outcome = "Pending".
the wall we seem to be running into is my
understanding
that "Conditional
Formatting" seems engineered to work with just one
Control at a time.
anyone?
.
.
.
.