Solved

Conditional Formatting in Access 2007

Posted on 2009-05-08
4
624 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
[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
  • 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

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

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

724 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