Solved

Conditional Formatting in Access 2007

Posted on 2009-05-08
4
595 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
ID: 24338355
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
ID: 24339623
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
ID: 24339629
Here's the file.
Todd
FormatReportControls.mdb
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

920 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

12 Experts available now in Live!

Get 1:1 Help Now