If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Reports
Can I use Access to create multiple reports for printout? I have a table
with many records. At any time people need to be able to printout a report for each record based a date or range of dates. When quried based on the query range I could have anywhere from 0 to say 100 reports to print. Is this possible? |
#2
|
|||
|
|||
Reports
On Fri, 5 Mar 2010 10:11:01 -0800, TheWizard wrote:
Can I use Access to create multiple reports for printout? I have a table with many records. At any time people need to be able to printout a report for each record based a date or range of dates. When quried based on the query range I could have anywhere from 0 to say 100 reports to print. Is this possible? ummm... yes. An Access "REPORT" object is sort of a template. It will usually be based on a Query which will return zero, one, or many records. It can (optionally) contain page break controls to control what appears on which sheet of paper; if your query returns 100 records and the Report has a page break between each record, you'll get 100 sheets of paper ("reports"). -- John W. Vinson [MVP] |
#3
|
|||
|
|||
Reports
I'm not quite sure what you are asking here. If you simply want to print
each record on a separate page then either do as John says and add a page break control to the bottom of the detail section, or group the report by whatever is the table's primary key, give it a group footer and set the footer's ForceNewPage property to 'After Section'. If on the other hand you want to produce multiples of each set of records, e. g. if 10 records are returned you might want 5 reports, each with all 10 records, then one way is to first create a table Counters with one column Counter of number (integer) data type. Fill this with values from 1 to whatever is the maximum number of reports you'll need. Next create a query which includes your table containing the data for the report, and the Counters table, but don't join this to the other table. In the query include parameters for the start and end date, so the query would be along these lines: PARAMETERS [Enter start date:] DATETIME, [Enter end date:] DATETIME, [Number to print:] SHORT; SELECT [YourTable].*, [Counters].[Counter] FROM [YourTable], [Counters] WHERE [YourDate] = [Enter start date:] AND [YourDate] DATEADD("d",1,[Enter end date:]) AND [Counter] = [Number to print:]; Group the report first by Counter and give it a group footer. Set the group footer's ForceNewPage property to 'After Section'. You can order/group within this grouping by whatever you wish. You don't need to include the Counter in a control in the report and the Counter group footer can be of zero height. When you open the report you'll be prompted to enter start and end dates and the number to print. The report will then open with however many sets of the data you chose to print, with a page break at the end of each set. The way this works is that when tables are included in a query but without an explicit join between them this results in the 'Cartesian product' of the tables, i.e. every row in one is joined to every row in the other. So by restricting the rows returned by Counter to those with a value of 10 or less say, these 10 rows will be joined to each of the rows returned by the other table. By grouping the report first on Counter the set joined to 1 is returned first in the report, then the set joined to 2 and so on, with a page break forced after each set. So while a single report is opened it is made up of multiple sets of the same data with page beaks between them. One thing to note is that you cannot use a report header as this will print only once, not at the start of each set. If you want a header' at the start of each set give the Counter group a group header and put whatever you want as the 'report header in this group header. If you want to number the pages for each separate report from 1 onwards add a text box to the page footer with a ControlSource of: =[Page] and in the Counter group header's Format event procedure put: Page = 1 Ken Sheridan Stafford, England TheWizard wrote: Can I use Access to create multiple reports for printout? I have a table with many records. At any time people need to be able to printout a report for each record based a date or range of dates. When quried based on the query range I could have anywhere from 0 to say 100 reports to print. Is this possible? -- Message posted via http://www.accessmonster.com |
Thread Tools | |
Display Modes | |
|
|