Solved

Access 2010 Conditional Formatting

Posted on 2013-11-03
8
1,012 Views
Last Modified: 2013-11-30
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.
0
Comment
Question by:jb702
  • 3
  • 3
8 Comments
 
LVL 61

Expert Comment

by:mbizup
Comment Utility
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?
0
 

Author Comment

by:jb702
Comment Utility
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
0
 
LVL 61

Expert Comment

by:mbizup
Comment Utility
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.
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 

Author Comment

by:jb702
Comment Utility
Yes. But that irrelevant really the problem is when u add a 4th condition you will get an error
0
 
LVL 61

Accepted Solution

by:
mbizup earned 500 total points
Comment Utility
Yep - seeing that now... and also other posts indicating that three conditions is a hard limit in VBA.  

Similar (unresolved) discussion here...

Linking directly to a post by mlmcc:
http://www.experts-exchange.com/Microsoft/Development/MS_Access/Q_27585837.html#a37615535
0
 

Author Comment

by:jb702
Comment Utility
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.
0
 
LVL 45

Expert Comment

by:Martin Liss
Comment Utility
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now