Default Forms, Reports and Databases
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:
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.
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.
Select the Textbox icon in the Toolbox (Access 1 - 2003) or on the Controls group of the
Design ribbon (Access 2007 and later.) The title of the Properties box reads, "Default
Text Box". Set the properties that new text boxes should inherit, such as:
Repeat the process for the default Combo Box as well. Be sure to turn Auto Correct off -
it is completely inappropriate for Access to correct items you are selecting from a list. Set
properties such as Font Name for the default Label, Command Button, and other
controls.
Save the form. A name that sorts first makes it easy to copy and paste the form to create
others.
You have already done most of the work, but the additional properties for a continuous
form might include:
A default report
The default report is designed in exactly the same way as the forms above. Create a blank
report, and set its properties and the default properties for each control in the Toolbox.
Suggestions:
1. Set the default margins to 0.7" all round, as this copes with the Unprintable area
of most printers:
o In Access 2010, click Page Setup on the Page Setup ribbon.
o In Access 2007, click the Extend arrow at the very bottom right of the
Page Layout group on the Page Setup ribbon.
o In Access 1 - 2003, choose Page Setup from the File menu, and click the
Margins tab.
2. Set the report's Width to 6.85". (Handles Letter and A4 with 1.4" for margins.)
4. Add a text box to the Report Header section to automatically print the report's
caption as its title. Its Control Source will be:
=[Report].[Caption]
5. Add a text box to the Page Footer section to show the page count. Use a Control
Source of:
="Page " & [Page] & " of " & [Pages]
The last suggestion avoids displaying "#Error" when the report has no data. Copy the
function below, and paste into a general module. Using the generic function means you
automatically get this protection with each report, yet it remains lightweight (no module)
which helps minimize the possibility of corruption. The code is:
strCaption = rpt.Caption
If strCaption = vbNullString Then
strCaption = rpt.Name
End If
DoCmd.CancelEvent
MsgBox "There are no records to include in report """ & _
strCaption & """.", vbInformation, "No Data..."
End Function
A default database
In Access 2007 and later, you can also create a default database, with the properties,
objects, and configuration you want whenever you create a new (blank) database.
1. Click the Office Button, and click New. Enter this file name:
C:\Program Files\Microsoft
Office\Templates\1033\Access\blank
and click Create. The name and location of the database are important.
If you installed Office to a different folder, locate the Templates on your
computer.
2. To set the database properties, click the Office Button and choose Access
Options.
On the Current Database tab of the dialog, uncheck the Name AutoCorrect
options to prevent these bugs.
On the Object Designers tab, uncheck Enable design changes for tables in
Datasheet view to prevent users modifying your schema.
Set other preferences (such as tabbed documents or overlapping windows, and
showing the Search box in the Nav Pane.)
3. After setting the options, set the references you want for your new databases.
Open the code window (Alt+F11) and choose References on the Tools menu.
4. Import any objects you always want in a new database, such as:
o the default form and report above,
o modules containing your commonly used functions,
o tables where you store configuration data,
o your splash screen, or other commonly used forms.
To import, click the External Data tab on the ribbon, then the Import Access
Database icon on the Import group.
Now any new database you create will have these objects included, properties set, and
references selected.
You can create default databases for both the new file format (accdb) and the old format
(mdb) by creating both a blank.accdb and a blank.mdb in the Access templates folder.
Conclusion
You will quickly discover these default forms, reports, and databases not only save time,
but help provide a consistency in style and functionality throughout your application.
Home Index of tips
You can create forms and reports from a SharePoint list and use them as views. 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. You can make an Access view the default
view for a list.
The views that you create by using Access 2007 are stored in a database file on the
Windows SharePoint Services server. When you open an Access view of a SharePoint
list, Access starts, and it displays the form or report. Because the database is stored on the
SharePoint site, the view can be opened by other users of the site. A user does not need to
know the location, on the SharePoint site, of the database file that contains the Access
view in order to use the view. In addition, the user does not even need to know how to
start Access — this is handled automatically by the SharePoint site.
Note A user needs Access 2007 installed on his or her computer to create, use, or
modify an Access view on a SharePoint site.
Use the following procedure to create an Access view of a SharePoint list that you are
viewing in your browser.
Access starts, and then prompts you to save a local copy of the database that will contain
your new view.
3. In the Save a Local Copy dialog box, browse to the location on your computer
where you want to save the copy, type a name for the local copy in the File Name
box, and then click Save.
Access saves and opens the local copy, and then the Create Access View dialog box
appears.
4. In the Create Access View dialog box, double-click the type of view that you
want to create.
5. You can customize your new view in Layout view, or you can switch to Design
view.
In Layout view you can resize and rearrange the controls in your view (such as labels and
fields), but you cannot add additional controls to your view. Layout view provides a data
preview that makes it easier to see how your changes will appear in the finished view.
In Design view you can resize and rearrange controls, and can add additional controls to
your view. However, Design view does not provide a data preview.
Tip You can switch between Design view and Layout view as much as you want. If
you use Design view to add controls to your view, you can then switch to Layout view
and arrange those controls on the view while previewing data.
6. After you make your customizations, on the Message Bar, click Publish to
SharePoint Site.
• On the Database Tools tab, in the Show/Hide group, click Message Bar.
7. By default, 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. In most cases, this is probably what you want, 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.
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. The
SharePoint site might also have specific libraries set up for publishing Access
views, in which case you might need to change the Save in location to select the
correct library.
The administrator of the SharePoint site can help you select the correct library.
8. Access supplies a name for the database in the File name box in the Publish to
Web Server dialog box. This name matches the name of the database that you
saved as a local copy. You can change the name if you want, but in most cases,
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.
9. Click Publish to save the database to the SharePoint site.
Top of Page
Important If you make an Access view the default view, list visitors who do not have
Access 2007 installed will not be able to use the list.
1. With the SharePoint list open, on the Settings menu, click List Settings.
2. On the List Settings page, under Views, click the name of the Access view that
you want to make the default view.
3. On the Edit View page, select Make this the default view and then click OK.
Top of Page
In read-only mode, you are able to change the data in the view, and to print the view, but
you cannot change the view design. If you want to change the view design, see the next
section of this article, Modify an Access view of a SharePoint list.
Top of Page
Note You can modify a local copy of an Access view regardless of your Windows
SharePoint Services permission level. However, to publish your modified view to the
SharePoint site, you need the Windows SharePoint Services Manage Lists permission,
which, by default, is included in the Design permission level. If you created the Access
view, you should already have the Manage Lists permission. If you are unsure, contact
your SharePoint site administrator to determine whether you have the permissions you
need.
1. With the Access view open, on the Message Bar, click Save As.
Note If the Message Bar does not appear, display it by doing the following:
• On the Database Tools tab, in the Show/Hide group, click Message Bar.
2. Click Yes when Access prompts you to close the view and all other open objects.
3. In the Save in box, specify the location where you want to save the local copy,
type a name for the local copy in the File name box, and then click Save.
Access saves the local copy of the database, and then opens it.
4. Do one of the following:
• To change the layout of the view without adding new controls, in the Navigation
Pane, right-click the view, and then click Layout View on the shortcut menu.
In Layout view you can resize and rearrange the controls in your view (such as labels and
fields), but you cannot add additional controls to your view. Layout view provides a data
preview that makes it easier to see how your changes will appear in the finished view.
• To add or remove controls in the view ( such as labels or fields), in the Navigation
Pane, right-click the view, and then click Design View on the shortcut menu.
In Design view you can resize and rearrange controls, and can add additional controls to
your view. However, Design view does not provide a data preview.
Note If you choose to edit the view in Design view and you plan to publish the revised
view to the SharePoint site, do not add any fields to the view that are not part of the
SharePoint list.
5. Tip You can switch between Design view and Layout view as much as you
want. If you use Design view to add controls to your view, you can then switch to
Layout view and arrange those controls on the view while previewing data.
After you finish modifying the view, if you have the Manage Lists permission on the
SharePoint site, you can publish the modified view by using the following procedure.
Note To obtain the Manage Lists permission, contact the administrator of the
SharePoint site.