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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing Font Color on Access Report 2

Status
Not open for further replies.

EBox

Programmer
Dec 5, 2001
70
US
Hi - this is probably an easy one for the experts out there, but puzzling for a beginner like me.

I want to set up an If statement in VB for my MS Access report to print a value in a bolded red font if the value of a variable is greater than 100% (or 1), but I'm not sure how to construct the statement.

The values I want this to affect are: A3, A7, A11, A15, A19, and A23. All are decimal, but formatted as a percentage in my report. I would otherwise like the fonts to remain black.

Any help anyone can offer is appreciated!

Thanks,
Eric
 
Do it within the Detail_Format event.

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If A3 > 1 Then
A3.ForeColor = vbBlack
A3.FontBold = False
Else
A3.ForeColor = vbRed
A3.FontBold = True
End If
End Sub
 
Norris68, thanks! I just stumbled across your post and was able to finally do something that I'd given up on a long time ago.

Ann
 
EBox,

In Access2K, you may use conditional formatting for this also.

In design view, select the fields you want to format, click Format - Conditional Formatting, and just enter the conditions (both logical and absolute are permitted) and the font, size, color , background color, etc)

Logicalman
 
Good grief! I totally forgot about conditional formatting. What's that about not seeing the forest for the trees? Thanks for a very good reminder, Logicalman.

Ann
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top