[ Pobierz całość w formacie PDF ]
.Reports are divided into sections,known as bands in most report-writing software packages.(In Access, these are simplycalled sections.) Access processes each data record from a table or dynaset, processing eachsection in order and deciding (for each record) whether to process fields or text in eachsection.For example, the report footer section is processed only after the last record isprocessed in the dynaset.A report is made up of groups of details for example, as shown in Figure 8-17, all theproducts sold by category.Each group must have an identifying group header, which for thefirst category in this example is Minivans.Each group also has a footer where you cancalculate the total cost and profit for each category.For Minivans, the total profit is$17,063.The page header contains column descriptions; the report header contains thereport title.Finally, the report footer contains grand totals for the report, and the page footerprints the page number.The Access sections are listed below:&' Report header.Prints only at the beginning of the report; used for title page.&' Page header.Prints at the top of each page.&' Group header.Prints before the first record of a group is processed.&' Detail.Prints each record in the table or dynaset.186 Part I &' Getting Functional with Office 2003&' Group footer.Prints after the last record of a group is processed.&' Page footer.Prints at the bottom of each page.&' Report footer.Prints only at the end of a report after all records are processed.Figure 8-17 shows these sections superimposed on a report.Figure 8-17: Typical Report Writer sections.How sections process dataMost sections are triggered by changes in the values of the data.Table 8-2 shows the recordsthat make up the dynaset for the Products Summary Report (Yes indicates that a section istriggered by the data).Chapter 8 &' Understanding and Creating Access Reports 187Table 8-2Processing Report SectionsCategory Product Report Page Category Detail Category Page ReportName Name Header Header Header Footer Footer FooterMinivans Mini-03 Yes Yes Yes Yes No No NoMinivans Mini-101 No No No Yes No No NoMinivans Mini-102 No No No Yes No No NoMinivans Mini-103 No No No Yes No No NoMinivans Mini-104 No No No Yes No No NoMinivans Mini-105 No No No Yes No No NoMinivans Mini-115 No No No Yes Yes No NoMotorHomes Mot-01 No No Yes Yes Yes No NoSUV SUV-076 No No Yes Yes No No NoSUV SUV-101 No No No Yes No No NoSUV SUV-102 No No No Yes No No NoSUV SUV-103 No No No Yes No No NoSUV SUV-104 No No No Yes No No NoSUV SUV-111 No No No Yes No No NoSUV SUV-112 No No No Yes No No NoSUV SUV-113 No No No Yes No No NoSUV SUV-568 No No No Yes Yes Yes NoAs you can see, Table 8-2 shows 17 records.Three groups of records are grouped by thecategory.There are seven Minivans, one Motor Homes, and nine SUVs.Each record in thetable has corresponding columns for each section in the report. Yes means that the recordtriggers processing in that section; No means that the section is not processed for thatrecord.This report is only one page, so it is very simple.The report header section is triggered by only the first record in the reports dynaset.Thissection is always processed first, regardless of the data.The report footer section is triggeredonly after the last record is processed, regardless of the data.188 Part I &' Getting Functional with Office 2003Access processes the page header section after the report header section for the first recordand then every time a new page is started.The page footer section is processed at the bottomof each page and after the report footer section of the last page.Group headers are triggered only by the first record in a group.Group footers are triggeredonly by the last record in a group.Notice that the Mot-01 Motor Homes record triggers botha group header and a group footer because it is the only record in a group.If three or morerecords are in a group, only the first or the last record can trigger a group header or footer;the middle records trigger only the detail section.Access always processes each record in the detail section (which is always triggered,regardless of the value of a data item).Most reports with a large amount of data have manydetail records and significantly fewer group header or footer records.This small report hasas many group header and footer records as it has detail records.The Report Writer sectionsFigure 8-18 shows what a report design looks like in Access.It is the Report Design windowfor the Products Summary Report.As you can see, the report is divided into seven sections.The group section displays data grouped by Categories, so you see the sections chrCategoryHeader and chrCategory Footer.Each of the other sections is also named for the type ofprocessing it performs.Figure 8-18: The Report Design window.You can place any type of text or field controls in any section, but Access processes the dataone record at a time.It also takes certain actions (based on the values of the group fields, thelocation of the page, or placement in the report) to make the bands or sections active.Theexample in Figure 8-18 is typical of a report with multiple sections.As you learned, eachsection in the report has a different purpose and different triggers.Chapter 8 &' Understanding and Creating Access Reports 189Page and report headers and footers must be added as pairs.To add one without the other,Noteafter the section is added, resize the section you don t want to a height of zero or set its Visibleproperty to No.CautionIf you remove a header or footer section, you also lose the controls in those sections.Report header sectionControls in the report header section are printed only once at the beginning of the report.Acommon use of a report header section is as a cover page or a cover letter or for informationthat needs to be communicated only once to the user of the report.You can also have controls in the report header section print on a separate page, whichenables you to create a title page and include a graphic or picture in the section.There is aForce New Page property in the Report Header that can be set to After Section that will placethe information in the Report Header into a separate page.In Figure 8-17, the report header section is not used.NoteOnly data from the first record can be placed in a report header.Page header sectionText or field controls in the page header section normally print at the top of every page.If areport header on the first page is not on a page of its own, the information in the page headersection prints just below the report header information.Typically, page headers serve ascolumn headers in group/total reports; they can also contain a title for the report
[ Pobierz całość w formacie PDF ]