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

Question re: Working with control properties on a report 1

Status
Not open for further replies.

tdfreeman

MIS
Mar 28, 2002
85
US
I don't know that this can be done, but I want to do the following:

I want to color code my report according to the data in it.

Basically, I am combining two reports into one table and comparing them. I have a field in my table called differences. It contains the color code that I want the record coded to. I want to produce the report and according to the value in differences, I want to set the background color of the other fields in that record to that value.

For example:

Record# Field1 Field2 Field3 Differences
1 R1F1 R1F2 R1F3 10092543 (Light Yellow)
2 R2F1 R2F2 R2F3 12632256 (Grey)

I want the fields in the report for record 1 to have a background color of Light Yellow. I want the fields in the report for record 2 to have a background color of Grey.

Does anyone know if this is possible and how to go about it?

Thanks in advance. Thank you for your help.

Tammy
 
try something like this
oh and dont forget to set the beackground of your textboxes to transparent


Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If difference = 12313 Then
Detail.BackColor = vbYellow
Else
Detail.BackColor = vbBlack
End If
End Sub
"What a wonderfull world" - Louis armstrong
 
Thanks for your help. How do I use the sub in the report? Thanks. Thank you for your help.

Tammy
 
copy this code in the on format event of the detail section

If difference = 12313 Then
Detail.BackColor = vbYellow
Else
Detail.BackColor = vbBlack
End If


uhm you will need to find the right numbers for grey "What a wonderfull world" - Louis armstrong
 
Just a note, access does have a usefull Conditional Formating tool. It's easier for me to use VBA but some people really like it.

Just select the control you would like to modify (either on a form or a report) and click "Format" then "Conditional Formatting..."

Its pretty handy for quick jobs. -Dustin
Rom 8:28
 
Thanks for both of your responses. I figured out Chrissie's response after I said I didn't know where to put it. It worked like a charm.

Thanks for the other idea. I will look into it for future reference.

I am going to post another question in a new thread about using the "conditional formatting" in the summary section. If you can help with that I would appreciate it.

Thanks for your help! I have always wondered if you could do something like that.

Tammy Thank you for your help.

Tammy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top