Solved

Conditional Formatting in Access 2007

Posted on 2009-05-08
4
582 Views
Last Modified: 2012-05-06
I have a report control that i need to format based on the value of the control.  This control will always have greater than 3 values that need to be formatted so i am trying to figure out how to apply this link to a report since it seems to be aimed at a form that will only show one of the formats at once (although as i stated, in my report there will always be the case where 4-6 colors will be necessary on the one control).  Can someone help me, 1) apply the below to a report and 2) apply the more than 4 conditions.

http://msdn.microsoft.com/en-us/library/aa139965(office.10).aspx
0
Comment
Question by:oralb
  • 2
4 Comments
 
LVL 10

Accepted Solution

by:
Michael Vasilevsky earned 250 total points
Comment Utility
I think the easiest thing to do is just add some VBA in the Report_Activate event. I think formatting has to be done on Report_Activate, not Report_Open or Report_Load, but I could be wrong about that. Something like the below.


Private Sub Report_Activate()
 

     Select Case Me!MyReportControl

           Case is <3

                Me!MyReportControl.Backcolor=#ED1C24 'red

           Case is 4

                Me!MyReportControl.Backcolor=#FFC20E 'orange

           Case is =5

                Me!MyReportControl.Backcolor=#FFF200 'yellow

           Case is >5

                Me!MyReportControl.Backcolor=#22B14C 'green

     end select

End Sub

Open in new window

0
 
LVL 7

Expert Comment

by:shambalad
Comment Utility
You don't really need to use conditional formatting in reports. Reports are similar to continuous forms with one big difference. In reports, you have 'Detail_Format' sub wherein you can set the properties of any text box in the row to anything you want. You can change the font for the textbox for that row to whatever you want. Bear in mind that if you do not change that property when the 'Detail_Format' sub  runs for the subsequent line, it will retain whatever property setting you had set previous. For instance, let's say you set the font weight to Bold for one line for whatever reason. If you do not change the font weight back to Normal for the next line, the text will continue to be bold.
See attached for more illustration of the concept.
Todd
0
 
LVL 7

Assisted Solution

by:shambalad
shambalad earned 250 total points
Comment Utility
Here's the file.
Todd
FormatReportControls.mdb
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

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