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!

list of backcolors, other ideas on shading a report

Status
Not open for further replies.

lorirobn

MIS
Mar 15, 2005
450
US
Hi,

Where can I find a list of backcolors to use in VBA?
I want to shade my report with different shading for different field values, the entire detail line, not just one field. It would be helpful to see a list of possible values, rather than playing around in 'define custom colors' like I am doing.

For example, I am exploring some greys, but the lightest I found was 15066597. I'm wondering if there is a lighter gray? Also, I happen to have backstyle set to Transparent, in the field's properties. But I notice that when it's Normal, it appears lighter. How can I set this dynamically using VBA?

Any other suggestions for distinguishing lines from each other? I have about 4 different types of lines on this very long report, and the user would like to have each one distinguished with a different shading. I don't want the shading to be too much, though - it'll look crazy!

Many thanks!
Lori
 
I would suggest that you just play with the colors/shades to see what makes sense. Then since you have "4 different types of lines" this suggests your color will be based on a value stored in a table. I would create a field in a table to store the color value so that you can add the color value to the report's record source query.

Use the On Format event of the detail section to set the backcolor to the value in the table.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Thanks, Duane.

My report will be printed in shades of gray only. I am playing around with shades of gray, and have it working fine, but I thought I read on here once about a website that lists color values for vba. I got 4 shades of gray, but I was just wondering what I am missing.

Is there such a website? My googling doesn't bring up any.

Thanks.
Lori
 
To find some color values, create a report that has 16 records in its record source. Add a text box to the detail section:
Name: txtNum
Control Source: =1
Running Sum: Over All
Add another text box to the detail section:
Name: txtColor
Control Source:
Set the fill of all controls to transparent.

Then add code to the On Format event of the detail section:
Code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    Dim lngColor As Long
    Dim intNum As Integer
    intNum = 255 - 8 * Me.txtNum
    lngColor = RGB(intNum, intNum, intNum)
    Me.Section(0).BackColor = lngColor
    Me.txtColor = lngColor
End Sub

Your report should look something like


Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top