Link to home
Start Free TrialLog in
Avatar of jb702
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.
Avatar of mbizup
mbizup
Flag of Kazakhstan image

Hazarding a guess that your database is stored in the old .mdb format.

You may need to save it in .accdb format to take advantage of that new addition.

Btw, what code are you using?
Avatar of jb702
jb702

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(acExpression, acEqual, "[StatusName] = 3")
        Set objFrc = .FormatConditions.Add(acExpression, acEqual, "[StatusName] = 8")
        Set objFrc = .FormatConditions.Add(acExpression, acEqual, "[StatusName] = 7")
'        Set objFrc = .FormatConditions.Add(acExpression, acEqual, "[StatusName] = 15")
       
'        i = .FormatConditions.count
                   
        .FormatConditions(0).BackColor = 42495
        .FormatConditions(0).Enabled = True
   
        .FormatConditions(1).BackColor = 14772545
        .FormatConditions(1).Enabled = True
   
        .FormatConditions(2).BackColor = 3937500
        .FormatConditions(2).Enabled = True
       
        .FormatConditions(3).BackColor = 3937500
        .FormatConditions(3).Enabled = True
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.
Avatar of jb702

ASKER

Yes. But that irrelevant really the problem is when u add a 4th condition you will get an error
ASKER CERTIFIED SOLUTION
Avatar of mbizup
mbizup
Flag of Kazakhstan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jb702

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.