Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Access 2010 Conditional Formatting

Posted on 2013-11-03
8
Medium Priority
?
1,114 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
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

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 2000 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 49

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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

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…
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

971 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