Access Cookbook - Ken Getz [36]
2.1. Make Custom Templates for Forms and Reports
Problem
When you make a new blank form, the form properties and the properties of any control placed on it use the Access defaults. You've decided upon a standard look for your forms and reports that is significantly different from these defaults, and you spend too much time changing control properties on every new form you create to make them match your look. You'd like some way to change the standard default values.
Solution
Access allows you to specify a particular form or report to use as a template for new forms or reports that you create. This solution lists the steps you'll need to take to create your own template for form design. The technique is the same for form templates and report templates.
To see the advantages of using a template to define a new form's settings, load 02-01.MDB and create a new form. Add controls of various types to the form. Notice that some of them look different from the normal Access defaults. To see where the properties are coming from, load the form named Normal from 02-01.MDB in design mode. Each of the controls on this form will act as a template for any new controls on any forms you create in this database. In addition, any new form you create will inherit its own properties from this template form.
To create your own template form, follow these steps:
Create a new blank form.
Make any general changes you want in the form properties, such as changing the GridX and GridY properties to different settings—many users may prefer 24 24, the smallest grid that will show dots. To do this, first display the properties sheet: click on the gray in the upper-left corner of the form or select the Edit → Select Form menu item. If you don't want a record selector, navigation buttons, minimize or maximize buttons, a control box, and/or scrollbars on your form template, turn them off in the layout section of the form's properties sheet. In addition, you can choose to center the form automatically when it is opened by changing the AutoCenter property to Yes.
You may also wish to change the form's background color by changing the background color for the form's detail section (click on the detail section bar in form design to select the section). If you want your forms to have page headers/footers or form headers/footers, activate them by checking Format → Page Header/Footer or Form Header/Footer and set their colors as well.
Once you have finished setting up the form's general properties, repeat the process to change the default settings for each control you want to modify. There are two ways you can do this:
Click on the tool for that control in the toolbox and change the properties in the control's properties sheet. Note that when you do this, the properties sheet's titlebar says Default Label (or whatever control you have selected), as shown in Figure 2-1.
Change the controls directly on your form. Add to your form each control type you want to change, and set the properties visibly. Once you're done, select the Format → Set Control Defaults menu item, with all the controls selected.
Figure 2-1. The Default Label properties sheet
Save your form with any name you like.
Finally,