Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Conditional Formatting in a Report

Status
Not open for further replies.

GKatReliable

Programmer
Jul 2, 2002
45
US
I have a user who puts out budget reports in Access, and wants a way to highlight an item in bold or italics or something to call attention to an exception, that being an amount or percent that has exceeded some limit.
Is there a way to have conditional formatting in the report form design surface to accomplish this?
Regards,
Glenn Koproske
 
There are different ways you can do this, but I do it in the Detail_Format event of the report. Go into the code window and select Detail_Format and type in your conditional formatting there like this: (This would make the backcolor change to red of the final budget text box on the report if the budget was greater than $200,000.) Other formatting options would be .FontBold = True, .ForeColor = vbBlue or whatever color, .FontSize = 12, etc.

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

If txtFinalBudget > 200000 Then
txtFinalBudget.BackColor = vbRed
End If
End Sub
 
If it is a simple comparison to data the is on the report you may be able to use the Conditional Format option for the controls. I don't think you can get real complicated with the Conditional formating option so then you would have to go to coding it in the report modules.

Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top