MeadInKent
| Feedback | A reports manager form |

Making a report template

Access Icon background

It is helpful to save a report containing your choice of standard formatting which can then be used as a basis for all new reports in your database. Access does let you nominate an existing report as a template which is used as the basis of any new reports (created in design mode) but it will not include any controls or fields - i.e. it is blank. I prefer to use a regular report containing common fields, labels, lines and formatting as a basis for new reports. This is not strictly a template like those created elsewhere in Microsoft Office - it will not prompt you to save new reports with another name and therefore you must be careful not to overwrite the original.

Some text boxes can be added to the report header and footer including items such as todays date and the page number.

="Printed: " & Format(Now(),"dd mmm yy hh:nn")
="Page " & [Page] & " of " & [Pages]

You can add a Label to your footer and it can be programmed to display the name of the report. To do this, edit the Label properties and rename it as 'RepNameFooter'. Then edit the Report properties and select the On Open event.

Report On Open event: [Event procedure]
Private Sub Report_Open(Cancel As Integer)
Me!RepNameFooter.Caption = "MeadInKent database program.  File: " & Me.Name
End Sub

If you prefer your reports to always be displayed in a full window (i.e. maximised) it is simple to include this instruction, either referring to an event procedure or a macro. In the database window, add a new macro containing the single command: 'Maximise'. Save it as 'MyMaximise'. Then edit the Report properties, select the On Activate event and add the macro name.

Report On Activate event: [Macro]
MyMaximise

It is helpful to include an instruction which will prevent a run time error in the event of there being no data to report.

Report On No Data event: [Event procedure]
Private Sub Report_NoData(Cancel As Integer)
MsgBox "There is no data to print", vbInformation + vbOKOnly, "NoData Cancellation"
Cancel = True
End Sub

Once you have added any other regular lines, logos and titles, save the report template. When creating a new report, edit the template, Save As another name and edit the properties to add the appropriate record source (i.e. a query or table containing the required data).

Creating a template saves time and gives your database application a consistent appearance.

Preview a template report in Microsoft Access
The properties dialog box of a template report

Access 2010 the missing manual

 
UK more ...   USA more ...

file: accreporttemplate.htm MeadInKent.co.uk 2014 Page last updated apr14