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

changing color of report field based on value

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I have MS Access 97 and I am trying to color in a field according to its value on a status report. For example if the value is green, I would like the field on the report to be green. Help says that there is an example in solutions.mdb, but I don't have that sample. It would be great if someone could post the code. Thanks!
 
I'm not sure about Access 97 but in report design, select the control.

From the format menu, select conditional formatting. Fill in the condition 1 section.
 
This is some code I used bfore on the report detail_print event, hope you can follow the logic basically if the field datecompleted is not null then format the text black otherwise if it is null colour field 'comments' red


Hope this helps

Andy

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)


If Not Me.DateCompleted Then
'ensure black if completed
Comments.ForeColor = 0
Else

'colour text red

Comments.ForeColor = 255

End If

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top