Setting Form and Control Defaults


When you’re building an application, you should establish a standard design for all your forms and the controls on your forms. Although you can use the AutoFormat templates, you might want to create a standard design that is different.

Changing Control Defaults

You can use the Set Control Defaults button in the Controls group on the Design tab to change the defaults for the various controls on your form. If you want to change the default property settings for all new controls of a particular type, select a control of that type, set the control’s properties to the desired default values, and then click the Set Control Defaults button in the Controls group on the Design tab. The settings of the currently selected control will become the default settings for any subsequent definitions of that type of control on your form.

For example, you might want all new labels to show blue text on a white background. To make this change, place a label on your form, and set the label’s Fore Color property to blue and its Back Color property to white using the Font Color and Fill/Back Color buttons in the Font group on the Design tab. Click the Set Control Defaults button in the Controls group on the Design tab while this label is selected. Any new labels you place on the form will have the new default settings.

Working with AutoFormat

After you define control defaults that give you the “look” you want for your application, you can also set these defaults as an AutoFormat that you can use in the Form Wizard. To create an AutoFormat definition, open the form that has the control defaults set the way you want them, click the arrow on the AutoFormat button in the AutoFormat group on the Arrange tab, and then click the AutoFormat Wizard button beneath the gallery of AutoFormats. Click the Customize button in the AutoFormat dialog box to open the Customize AutoFormat dialog box shown in Figure 12–50. Select the Create A New AutoFormat option to save a format that matches the form you currently have open, and then click OK. In the next dialog box, type a name for your new format, and then click OK. Your new format now appears in the list of form AutoFormats. As you saw in Chapter 11, you can select any of the form AutoFormats to dictate the look of a form created by the Form Wizard.

image from book
Figure 12–50: You can create your own custom AutoFormat definitions.

If you have previously defined an AutoFormat, you can update it or delete it using the AutoFormat dialog box. You can also update or delete any of the built-in formats.

Defining a Template Form

You can also create a special form to define new default properties for all your controls. To do this, open a new blank form and place on it one of each type of control for which you want to define default properties. Modify the properties of the controls to your liking, use these controls to reset the control defaults for the form (by clicking the Set Control Defaults button in the Controls group on the Design tab for each control), and save the form with the name Normal. The Normal form becomes the template form for the current database. Any new control you place on any new form created after you define your template form (except forms for which you’ve already changed the default for one or more controls) will use the default property settings you defined for that control type on the Normal form. Note that defining a template form does not affect any existing forms. Also, you can revert to the standard settings by deleting the Normal form from your database.

To define a name other than Normal for your default form and report templates, click the Microsoft Office Button, click Access Options, and then click the Object Designers category. Enter the new name in the Form Template text box in the Forms/Reports section. Then save your template under the new name you specified in the Object Designers category. Note that this new setting becomes the default for all databases on your computer, but if Access doesn’t find a form in your database with the name you specified, it uses the standard default settings instead.

If you want to see how this works in the HousingDataCopy.accdb sample database, click the Microsoft Office Button, click Access Options, and then click the Object Designers category. In the Forms/Reports section, enter zsfrmTemplate in the Form Template box, and click OK. Next, click the Blank Form button in the Forms group on the Create tab to create a blank form. Your new form should have a header and footer and the Trek background. Try dropping a few controls onto the form. Although we started with the Trek template, we modified the look of labels, text boxes, combo boxes, list boxes, and command buttons in the template form to be different. Figure 12–51 shows you our template in Design view. Note that your new form not only inherits control properties but also inherits the height and width of each of the sections from the template.

Caution 

Be sure to change your default template name back to Normal before going any further. This setting affects all your databases but won’t hurt anything unless you happen to have a form named zsfrmTemplate in some of your databases.

image from book
Figure 12–51: This is the zsfrmTemplate sample template form in the HousingDataCopy.accdb sample database.

Now you should be comfortable with designing forms and adding special touches to make your forms more attractive and usable. In the next chapter, you’ll learn advanced form design techniques: using multiple-table queries in forms, building forms within forms, and working with ActiveX controls, PivotTables, and PivotCharts.




Microsoft Office Access 2007 Inside Out
MicrosoftВ® Office Access(TM) 2007 Inside Out (Microsoft Office Access Inside Out)
ISBN: 0735623252
EAN: 2147483647
Year: 2007
Pages: 234

Similar book on Amazon
Access 2007: The Missing Manual
Access 2007: The Missing Manual
Microsoftu00ae Office Access(TM) 2007 Step by Step (Step By Step (Microsoft))
Microsoftu00ae Office Access(TM) 2007 Step by Step (Step By Step (Microsoft))
Microsoft Office Access 2007 Forms, Reports, and Queries
Microsoft Office Access 2007 Forms, Reports, and Queries
Alison Balter's Mastering Microsoft Office Access 2007 Development
Alison Balter's Mastering Microsoft Office Access 2007 Development

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net