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!

Displaying first and last value on a page in footer 1

Status
Not open for further replies.

amoeba102

Programmer
Apr 2, 2002
58
US
Telephone books have the first and last name on the page placed in a header, for ease of use in finding a name in a 1000 (or more/less) page book. I need to do this (except in the footer), and so far have failed abysmally. Any suggestions on the best way of accomplishing this?

Using CR 8.5. This particular report is being run from an Access database.
 
Amoeba,

Create a new Page Header section, so you have Page Header a and b.

In Page Header a, place the following formula:

//@1stNameSetTrue
WhilePrintingRecords;
BooleanVar Rename := True;

In Page Header b, place:

//@1stName
WhilePrintingRecords;
If BooleanVar Rename = True Then
StringVar 1stName := {YourNameField} else 1stName;

If you have a group with Repeated Header on Each New Page option turned on, then place the following formula in the group header section. Otherwise, insert another Page Header (c) and place it in there:

//@1stNameSetFalse
WhilePrintingRecords;
BooleanVar Rename := False;

In the Page Footer:
//@Name Range
{@1stName} + " to " + {YourNameField}


Naith
 
It makes a big difference if you have groups. The page header takes it's value from the first (active) record on the page, and the page footer from the last. So if you don't have any groups you could use 2 formulas:

PH:
WhilePrintingRecords;
STringVar first:= {Customer.Customer Name}

PF:
WhilePrintingRecords;
STringVar first;
first + ' to ' + {Customer.Customer Name}


However, if you have groups, whenever the group footer starts a page the Page Header will still be reading the last value on the previous page. You would need to 'capture' the name in the first detail line, not the page header. So with groups you shoud use 3 formulas:

PH:
WhilePrintingRecords;
BooleanVar TopPage:= True;

Detail:
WhilePrintingRecords;
BooleanVar TopPage;
STringVar first;
If TopPage
then (first:= {Customer.Customer Name}; TopPage:=False)

PF:
WhilePrintingRecords;
STringVar first;
first + ' to ' + {Customer.Customer Name}
Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Perfect - thanks!!!
I didn't know that header picked up first and footer picked up last. How easy!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top