J
Jim Shortslef
I have been using code to set up conditional formatting in
a form with no problem. Everything has been working as
expected. The problem is that I am now trying to use
conditional formatting on a report that is called by the
form. When the form is opened I get the following error:
Run-time error '7966':
The Format condition number you specified is greater then
the number of format conditions.
Below is the code for setting up the conditional formating
in my report.
Sub RColor(Loc As String, NumEnt As Integer, B1Max As
Single, B2Max As Single, B3Max As Single)
Dim objFrc1 As FormatCondition
Dim Red As Long, Green As Long, Yellow As Long, Orange As
Long
Red = RGB(255, 25, 50)
Green = RGB(0, 150, 0)
Yellow = RGB(250, 250, 50)
Orange = RGB(255, 125, 0)
Set objFrc1 = Reports!rpt_RankFinal!
(Loc).FormatConditions.Add(acFieldValue, acBetween, 0,
B1Max)
Set objFrc1 = Reports!rpt_RankFinal!
(Loc).FormatConditions.Add(acFieldValue, acBetween, B1Max,
B2Max)
Set objFrc1 = Reports!rpt_RankFinal!
(Loc).FormatConditions.Add(acFieldValue, acBetween, B2Max,
B3Max)
With Reports!rpt_RankFinal!(Loc).FormatConditions(0)
.BackColor = Green
.ForeColor = Green
End With
With Reports!rpt_RankFinal!(Loc).FormatConditions(1)
.BackColor = Yellow
.ForeColor = Yellow
End With
With Reports!rpt_RankFinal!(Loc).FormatConditions(2)
.BackColor = Orange
.ForeColor = Orange
End With
End Sub
I have spent 2 days trying to figure out why I get this
error. Can it be that I can not use conditional
formatting twice at the same time? (In my form and then in
my report which is opened by the form?) Any suggestions
on what is going on here would be appreciated. What do I
need to do to get the formatting working in my report?
Jim
a form with no problem. Everything has been working as
expected. The problem is that I am now trying to use
conditional formatting on a report that is called by the
form. When the form is opened I get the following error:
Run-time error '7966':
The Format condition number you specified is greater then
the number of format conditions.
Below is the code for setting up the conditional formating
in my report.
Sub RColor(Loc As String, NumEnt As Integer, B1Max As
Single, B2Max As Single, B3Max As Single)
Dim objFrc1 As FormatCondition
Dim Red As Long, Green As Long, Yellow As Long, Orange As
Long
Red = RGB(255, 25, 50)
Green = RGB(0, 150, 0)
Yellow = RGB(250, 250, 50)
Orange = RGB(255, 125, 0)
Set objFrc1 = Reports!rpt_RankFinal!
(Loc).FormatConditions.Add(acFieldValue, acBetween, 0,
B1Max)
Set objFrc1 = Reports!rpt_RankFinal!
(Loc).FormatConditions.Add(acFieldValue, acBetween, B1Max,
B2Max)
Set objFrc1 = Reports!rpt_RankFinal!
(Loc).FormatConditions.Add(acFieldValue, acBetween, B2Max,
B3Max)
With Reports!rpt_RankFinal!(Loc).FormatConditions(0)
.BackColor = Green
.ForeColor = Green
End With
With Reports!rpt_RankFinal!(Loc).FormatConditions(1)
.BackColor = Yellow
.ForeColor = Yellow
End With
With Reports!rpt_RankFinal!(Loc).FormatConditions(2)
.BackColor = Orange
.ForeColor = Orange
End With
End Sub
I have spent 2 days trying to figure out why I get this
error. Can it be that I can not use conditional
formatting twice at the same time? (In my form and then in
my report which is opened by the form?) Any suggestions
on what is going on here would be appreciated. What do I
need to do to get the formatting working in my report?
Jim