You are on page 1of 9

Default forms, reports and databases

Access provides a way to set up a form and a report, and nominate them as the template
for new forms and reports:

• in Access 2010: File | Access Options | Object Designers,
• in Access 2007: Office Button | Access Options | Object Designers,
• in Access 1 — 2003: Tools | Options | Forms/Reports.

That's useful, as it lets you create forms and reports quickly to your own style.

However, these forms/reports do not inherit all properties and code. You will get a better
result if you copy and paste your template form or report in the database window
(Access 1 - 2003) or Nav Pane (Access 2007 and later.) The form created this way
inherits all properties and event procedures.

It will take you 30-45 minutes to set up these default documents. They will save 5-15
minutes on every form or report you create.

A default form
Create a new form, in design view. If you normally provide navigation or filtering
options in the Form Header section, display it:

• in Access 2010: right-click the Detail section, and choose Form Header/Footer,
• in Access 2007: Show/Hide (rightmost icon) on the Layout ribbon,
• in Access 1-2003: Form Header/Footer on View menu.

Drag these sections to the appropriate height.

In addition to your visual preferences, consider setting properties such as these:

Disallow runtime
Allow Design Changes Design View Only changes. (Access 2003
and earlier.)
Allow PivotTable View No Disallowing these views
prevents tinkerers from
Allow PivotChart View No trying them from the
toolbar or View menu.
Adjust for the minimum
Width 6" screen resolution you
anticipate.

Now comes the important part: set the default properties for each type of control.

Repeat the process for the default Combo Box as well. set Add Colon to No. to trap data errors. A default report . • Form_Close. Create other "template forms" as you have need. "Default Text Box". Add any event procedures you usually want.) The title of the Properties box reads. but the additional properties for a continuous form might include: • Set the form's Default View property to Continuous Forms. such as: Special Effect Flat Whatever your style is. Set properties such as Font Name for the default Label. Save the form. Be sure to turn Auto Correct off - it is completely inappropriate for Access to correct items you are selecting from a list. A name that sorts first makes it easy to copy and paste the form to create others. • Form_Error. Generally you want this Allow AutoCorrect No on for memo fields only. You have already done most of the work. This will save removing the colon from each attached label when you cut them from the Detail section and paste them into the Form Header.2003) or on the Controls group of the Design ribbon (Access 2007 and later. Command Button. A default Continuous Form Copy and paste the form created above. and other controls. • If your continuous forms are usually subforms. to validate the record. Set the properties that new text boxes should inherit. to ensure something (such as a Switchboard) is still open. consider adding code to cancel the form's Before Insert event if there is no record in the parent form. Choose a font that will Font Name MS Sans Serif definitely be on your user's system. • For the default Text Box.Select the Textbox icon in the Toolbox (Access 1 . such as: • Form_BeforeUpdate. This form will be the one you copy and paste to create continuous forms.

2. (Handles Letter and A4 with 1. and paste into a general module. in Access 2007. Set the report's Width to 6. Add a text box to the Page Footer section to show the page count. 'Usage: =NoData([Report]) Dim strCaption As String 'Caption of report. 4. o In Access 2007.2003. and set its properties and the default properties for each control in the Toolbox. o In Access 2007.4" for margins. Use a Control Source of: ="Page " & [Page] & " of " & [Pages] 6.) 3. Create a blank report. Add a text box to the Report Header section to automatically print the report's caption as its title.7" all round.2003. and choose Report Header/Footer. o In Access 1 .85". Show/Hide (rightmost icon) on the Layout ribbon.Caption If strCaption = vbNullString Then strCaption = rpt. o In Access 2010. and click the Margins tab. click Page Setup on the Page Setup ribbon. Using the generic function means you automatically get this protection with each report. as this copes with the Unprintable area of most printers: o In Access 2010. Show the Report Header/Footer (View menu in Access 1 .Name End If . o In Access 1 . click the Extend arrow at the very bottom right of the Page Layout group on the Page Setup ribbon. yet it remains lightweight (no module) which helps minimize the possibility of corruption. Set the default margins to 0.[Caption] 5. choose Page Setup from the File menu. the rightmost icon in the Show/Hide group on the Layout ribbon).2003. strCaption = rpt. Suggestions: 1. right-click the Detail section. View menu. Its Control Source will be: =[Report]. The code is: Public Function NoData(rpt As Report) 'Purpose: Called by report's NoData event. Copy the function below.The default report is designed in exactly the same way as the forms above. Set the On No Data property to: =NoData([Report]) The last suggestion avoids displaying "#Error" when the report has no data.

On the Object Designers tab. Enter this file name: C:\Program Files\Microsoft Office\Templates\1033\Access\blank and click Create. After setting the options. You can create default databases for both the new file format (accdb) and the old format (mdb) by creating both a blank. set the references you want for your new databases. 2. 1. To import. Import any objects you always want in a new database. locate the Templates on your computer. The name and location of the database are important.. Click the Office Button. Open the code window (Alt+F11) and choose References on the Tools menu. but help provide a consistency in style and functionality throughout your application. o tables where you store configuration data.mdb in the Access templates folder. "No Data. If you installed Office to a different folder.accdb and a blank." End Function A default database In Access 2007 and later. click the External Data tab on the ribbon.CancelEvent MsgBox "There are no records to include in report """ & _ strCaption & """. and databases not only save time. or other commonly used forms. then the Import Access Database icon on the Import group.) 3.. vbInformation. and showing the Search box in the Nav Pane. and click New.". objects. properties set. DoCmd. On the Current Database tab of the dialog. Conclusion You will quickly discover these default forms. click the Office Button and choose Access Options. Set other preferences (such as tabbed documents or overlapping windows. Now any new database you create will have these objects included. such as: o the default form and report above. with the properties. o your splash screen. and references selected. To set the database properties. 4. o modules containing your commonly used functions. you can also create a default database. . and configuration you want whenever you create a new (blank) database. uncheck Enable design changes for tables in Datasheet view to prevent users modifying your schema. reports. uncheck the Name AutoCorrect options to prevent these bugs.

you can easily make it available to other users. use. and you can then customize your view. . By publishing your view on the SharePoint site. or modify an Access view on a SharePoint site. of the database file that contains the Access view in order to use the view. the view can be opened by other users of the site. Access starts automatically. on the SharePoint site. Note A user needs Access 2007 installed on his or her computer to create. the user does not even need to know how to start Access — this is handled automatically by the SharePoint site. When you open an Access view of a SharePoint list. In Access. What do you want to do? • Create an Access view of a SharePoint list • Make an Access view the default view for a SharePoint list • Use an Access view of a SharePoint list • Modify an Access view of a SharePoint list Create an Access view of a SharePoint list When you create an Access view of a SharePoint list. you can base your view on a variety of form and report templates. The views that you create by using Access 2007 are stored in a database file on the Windows SharePoint Services server. Users of the SharePoint site who have Access 2007 installed can open these forms and reports by using the View menu of the SharePoint list. Home Index of tips Create Access forms and reports from a SharePoint list Applies to: Microsoft Office Access 2007 Print You can create forms and reports from a SharePoint list and use them as views. In addition. and it displays the form or report. A user does not need to know the location. You can make an Access view the default view for a list. Access starts. Because the database is stored on the SharePoint site.

or you can switch to Design view. In the Create Access View dialog box. is included in the Design permission level. Tip You can switch between Design view and Layout view as much as you want. 6. and then prompts you to save a local copy of the database that will contain your new view. which. on the View menu . On the SharePoint site. Layout view provides a data preview that makes it easier to see how your changes will appear in the finished view. and then click Save. by default. double-click the type of view that you want to create. Use the following procedure to create an Access view of a SharePoint list that you are viewing in your browser. on the Message Bar. click Create View. you can then switch to Layout view and arrange those controls on the view while previewing data. In Layout view you can resize and rearrange the controls in your view (such as labels and fields). click Publish to SharePoint Site. you need the Windows SharePoint Services Manage Lists permission. If you use Design view to add controls to your view. and can add additional controls to your view. and then the Create Access View dialog box appears. On the Create View page. You can customize your new view in Layout view. Access saves and opens the local copy. click Access View. However. 3. Access creates your new view and opens it in Layout view. 4. In Design view you can resize and rearrange controls. but you cannot add additional controls to your view. browse to the location on your computer where you want to save the copy. After you make your customizations. 2. 5. 1. type a name for the local copy in the File Name box.Note To create a view of a SharePoint list. Access starts. The Publish to Web Server dialog box appears. Design view does not provide a data preview. In the Save a Local Copy dialog box. .

click List Settings. list visitors who do not have Access 2007 installed will not be able to use the list. on the Settings menu. 3. if those users have Access installed on their computers. You can change the name if you want. The administrator of the SharePoint site can help you select the correct library. In most cases. The SharePoint site might also have specific libraries set up for publishing Access views. Click Publish to save the database to the SharePoint site. in the Show/Hide group. Access supplies a name for the database in the File name box in the Publish to Web Server dialog box. under Views. this is probably what you want. 8. you should accept the suggested name — this will make it easier to remember which local database corresponds to the database that you publish on the SharePoint site. By default. select Make this the default view and then click OK. the Access view opens automatically when users open the list. 9. With the SharePoint list open. but in most cases. Important If you make an Access view the default view. Access saves the view in a database file located in the Shared Documents library on the SharePoint site — this site contains the list from which you created the view. Top of Page Use an Access view of a SharePoint list . This name matches the name of the database that you saved as a local copy. display it by doing the following: • On the Database Tools tab. in which case you might need to change the Save in location to select the correct library. On the List Settings page. 2. click Message Bar. 7. 1. click the name of the Access view that you want to make the default view.Note If the Message Bar does not appear. You can do this to more specifically control who has access to the view and whether users can open the view in read-only mode or in edit mode. Top of Page Make an Access view the default view for SharePoint list When you make an Access view the default view for a SharePoint list. On the Edit View page. but you can change the document library in which to store the database by choosing a different library in the Save in box in the Publish to Web Server dialog box.

2.To use an Access view of a SharePoint list. Modify an Access view of a SharePoint list. click the name of the Access view. If you want to change the view design. you need the Windows SharePoint Services Manage Lists permission. However. click Message Bar. The Save As dialog box appears. • On the View menu . specify the location where you want to save the local copy. You can then use your local copy of the view or. If you are unsure. and then opens it. you can publish the new view. 3. click Save As. Access saves the local copy of the database. by default. If you created the Access view. Access starts. Note If the Message Bar does not appear. 1. and then click Save. Note You can modify a local copy of an Access view regardless of your Windows SharePoint Services permission level. to publish your modified view to the SharePoint site. With the Access view open. but you cannot change the view design. In read-only mode. you save a local copy of the database that contains the Access view. contact your SharePoint site administrator to determine whether you have the permissions you need. see the next section of this article. and to print the view. is included in the Design permission level. and then make changes. display it by doing the following: • On the Database Tools tab. type a name for the local copy in the File name box. . In the Save in box. on the Message Bar. you should already have the Manage Lists permission. if you have appropriate permissions on the SharePoint site. you are able to change the data in the view. which. in the Show/Hide group. and then displays the view in read-only mode. Top of Page Modify an Access view of a SharePoint list To modify the design of an Access view. you choose the Access view from the View menu of the list. Click Yes when Access prompts you to close the view and all other open objects.

On the Message Bar. If you use Design view to add controls to your view. Note If you choose to edit the view in Design view and you plan to publish the revised view to the SharePoint site. Design view does not provide a data preview. contact the administrator of the SharePoint site. if you have the Manage Lists permission on the SharePoint site. click Publish to SharePoint Site. 2. and then click Design View on the shortcut menu. right-click the view. Publish the modified Access view to the SharePoint site After you finish modifying the view. do not add any fields to the view that are not part of the SharePoint list. but you cannot add additional controls to your view. you can publish the modified view by using the following procedure. in the Navigation Pane. However. and then click Layout View on the shortcut menu. in the Navigation Pane. you can then switch to Layout view and arrange those controls on the view while previewing data. Tip You can switch between Design view and Layout view as much as you want. Note To obtain the Manage Lists permission. Do one of the following: • To change the layout of the view without adding new controls. Save the view in the local copy of the database. 1. Layout view provides a data preview that makes it easier to see how your changes will appear in the finished view. 5. In Layout view you can resize and rearrange the controls in your view (such as labels and fields). In Design view you can resize and rearrange controls. and can add additional controls to your view. right-click the view. 4. . • To add or remove controls in the view ( such as labels or fields).