Solved

Conditional Formatting in Access 2007

Posted on 2009-05-08
4
613 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
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…

809 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