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

Highlight every other Record. 2

Status
Not open for further replies.

jerry15

Technical User
Oct 1, 2004
3
US
I am working with a database field titled Object Codes. Examples of the object codes are 10000, 11000, 13000, 24000. I have a formula that will highlight every other record either Silver or NoColor. The formula is " If RecordNumber Mod 2 = 0 then crSilver Else crNoColor". This formula works fine if it is assigned to the Details Section of the report. The formula is typed in the Color Tab of the Section Expert window. Since the Object Codes in the Detail section have multiple object codes that are alike; i.e., (Three seperate object codes 11000, Ten object codes 13000) I created a Group Section that combines like object codes and a sum of all like object codes. Now, when I print the report and use the formual in the Group Section, the shading of the records printed is not every other line since the records are not in the Detail Section numeric order. Is there a formula that will shade every other line when using the Group Section?

Thank you -- jerry
 
Put this formula in the BackColor condition formula for the Group section:

WhilePrintingRecords;
NumberVar GrpCount := GrpCount + 1;
if GrpCount Mod 2 = 1 then
crSilver
else
crNoColor

-dave
 
If this is your only group, and you are suppressing the details, then try:

if remainder(groupnumber,2) = 0 then crSilver else crNoColor

Otherwise, if you are displaying some combination of groups and details, you could create a variable {@linecnt} to be placed in each displayed section (group header and detail and group footer, e.g.):

whileprintingrecords;
numbervar linecnt := linecnt + 1;

Then use:

if remainder({@linecnt},2) = 0 then crSilver else crNoColor

-LB
 
Good morning,

I have one condition to add to the previous email. I have a condition statement in Group 2 that suppreses a record if all fields in that record are zero. When I use the recommended formulas the suppressed record is given a Cnt number. Then when the report is printed, the shading will not shade every other line due to the suppressed records. Is there coding that can be added to the recommended formulas that will not add a Cnt number to the suppressed records or ignore the suppressed records?

Thank you for the previous formulas. Except for the above condition, they worked great.

Thank you in advanced for your help.

jerry15
 
In {@linecnt}, add the condition that you are using for suppression, e.g.,

whileprintingrecords;
numbervar linecnt;

if sum({table.field},{table.group}) > 0 then linecnt := linecnt + 1 else linecnt := linecnt;

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top