Solved

Access 2010 Conditional Formatting

Posted on 2013-11-03
8
1,049 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
Industry Leaders: 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 47

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

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!

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
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.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

756 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