jb702
asked on
Access 2010 Conditional Formatting
In Access 2010 MS has given us the ability to add many conditions to the conditional formatting tool through the design form. But when i try to set the conditional formatting through vba i can't get more than the 3 formats they typically allowed.
Does anyone know why this is.
Does anyone know why this is.
ASKER
I'm using .accdb format. and this is the code i was testing with.
Private Sub ApplyCondFormatting()
Dim objFrc As FormatCondition
Dim i As Integer
With Me.StatusName
.FormatConditions.Delete
Set objFrc = .FormatConditions.Add(acEx pression, acEqual, "[StatusName] = 3")
Set objFrc = .FormatConditions.Add(acEx pression, acEqual, "[StatusName] = 8")
Set objFrc = .FormatConditions.Add(acEx pression, acEqual, "[StatusName] = 7")
' Set objFrc = .FormatConditions.Add(acEx pression, acEqual, "[StatusName] = 15")
' i = .FormatConditions.count
.FormatConditions(0).BackC olor = 42495
.FormatConditions(0).Enabl ed = True
.FormatConditions(1).BackC olor = 14772545
.FormatConditions(1).Enabl ed = True
.FormatConditions(2).BackC olor = 3937500
.FormatConditions(2).Enabl ed = True
.FormatConditions(3).BackC olor = 3937500
.FormatConditions(3).Enabl ed = True
End With
Set objFrc = Nothing
End Sub
Private Sub ApplyCondFormatting()
Dim objFrc As FormatCondition
Dim i As Integer
With Me.StatusName
.FormatConditions.Delete
Set objFrc = .FormatConditions.Add(acEx
Set objFrc = .FormatConditions.Add(acEx
Set objFrc = .FormatConditions.Add(acEx
' Set objFrc = .FormatConditions.Add(acEx
' i = .FormatConditions.count
.FormatConditions(0).BackC
.FormatConditions(0).Enabl
.FormatConditions(1).BackC
.FormatConditions(1).Enabl
.FormatConditions(2).BackC
.FormatConditions(2).Enabl
.FormatConditions(3).BackC
.FormatConditions(3).Enabl
End With
Set objFrc = Nothing
End Sub
I haven't tested it yet, but one possible issue with your code is that the formatting for conditions 2 and 3 is identical... they both set the same backcolor.
ASKER
Yes. But that irrelevant really the problem is when u add a 4th condition you will get an error
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I don't mind using the design view to set the formatting but i have found that that if you set it with vba, you won't get as much flicker. I have a piece of code that sets an outlook reminder from access...and even though the code doesn't manipulate or change or alter the form in access, it still flickers. Drives me nuts...Echo is being used by the way.
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
You may need to save it in .accdb format to take advantage of that new addition.
Btw, what code are you using?