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

Simple row shading? 2

Status
Not open for further replies.

Palmbak

Technical User
Dec 17, 2002
25
US
Is there a conditional formatting option available for shading alternating rows? Whether it be a Group1 or Group2 or Detail sections of a report. Anyone have any suggestions?


Thanks in advance,

Jon
 
Conditionally set your colour with the formula:

If Remainder(RecordNumber,2) = 0
Then crYellow //crSilver, crBlue, whatever
Else NoColor

For custom colours, change the crColour reference to Color(nnn,nnn,nnn) - with numbers for the 'n's.

Naith
 
To alternate everyband, you would need to use a formula, one copy in each band that keeps adding one to itself.

This one goes into the bands and is suppressed

//shade<formula name
whileprintingrecords;
numbervar plus1:=plus1+1;
plus1

This one goes in each band conditional coloring.
if remainder({@shade},2)=1 then gray else defaultattribute

Mike
 
Mike, your first formula does exactly what the RecordNumber function does, which eliminates the need for additional formulas. You can do this with one conditional formula.
 
You can conditionally shade every row so they change color but I don't like doing that. Why??? because I have set up nice crisp margins only to have the shading bleed from edge to edge making my margins look like crap.

What I do instead is overlay an empty text field from margin to margin with the background color I want alternated...then I apply a formula like Naith has given for the conditional background

If Remainder(RecordNumber,2) = 0
Then crYellow //crSilver, crBlue, whatever
Else NoColor

This technique is also very useful if you want only part of a line highlighted...say when you want data flagged in a report for being unusual but not the whole line.

Jim Broadbent
 
Naith,

The original post asks for the alternating of band colors
Whether it be a Group1 or Group2 or Detail sections of a report.

Using recordnumber will not change the band colors of groups. If there are three groupings, Group1 Group2 and Group3 and the first record would all be the same color.

My interpetation of the post was that Jim wanted every other band to alternate independent of the band's type.

Mike
 
You're absolutely right, Mike. The RecordNumber function is aimed at detailing. Sorry - I didn't pay attention to the initial request.

Naith
 
you can use Mike's formula in my approach...too

Signed Jim......formerly known as Jan :)

Jim Broadbent
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top