Solved

Access 2010 Conditional Formatting

Posted on 2013-11-03
8
1,075 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
8 Comments
 
LVL 61

Expert Comment

by:mbizup
ID: 39620257
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
ID: 39620326
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
ID: 39620477
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:jb702
ID: 39620488
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
ID: 39620513
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
ID: 39620581
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 48

Expert Comment

by:Martin Liss
ID: 39686670
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Suggested Courses
Course of the Month3 days, 19 hours left to enroll

630 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