09.04.09
Designing a form template in Access 2003
So I’ve been using MS Access since about 2.0 and finally figured something out the other day. Maybe I’m a little late to the party, but I think it’s a somewhat subtle time-saving trick so I’ll lay it out here.
I don’t know about you, but I spend a lot of time on form design in Access. Getting a consistent look and feel for an app’s forms are, I think, a way to really distinguish a professionally designed app from an amateur one. And if I can shave off 15 to 30 minutes of form design time, that makes me that much more productive (and profitable).
My “major” revelation was designing a form template and setting the default properties for the controls to be used on that form. You can configure Access so that, every time you drop a new control onto your form (or report), it automatically has the same Back Color or Font Size, etc.
Here it is, step by step:
1. Create a new form, save it and give it a name something like “frmTemplate”.
2. Open the new form in Design mode
3. Open the Toolbox and Properties windows
4. Choose a control in the Toolbox, but don’t draw or drop it on the form yet. Notice that the Properties window titlebar now says, “Default Control Name“, i.e. click on the Textbox tool and the Properties titlebar shows “Default Text Box”.
5. Set the properties for the control as you prefer. This will vary depending on the control and the look and feel you want for your form or report. For labels, I like to set the Back Color, Fore Color, Font Name, Font Size, Font Weight and Height. For text boxes, I’ll usually set Border Color, Height and the Font stuff.
6. Repeat for whatever controls you most often use on your forms.
6. Add any standard event procedures you want, such as:
- Form_BeforeUpdate, to validate the record;
- Form_Error, to trap data errors;
- Form_Close, to ensure another form (such as a Switchboard or Login) is opened.
7. Save your template form.
8. You can set your template form as the Normal template in Tools…Options…Forms/Reports tab by typing your new form or report name in the Form Template or Report Template textboxes. I’ve noticed a few issues with new forms created from the template inheriting properties and code properly, just as a word of warning. So what I usually do is to just Copy and Paste my template form by hand. Creating a form this way ensures it inherits all properties and event procedures.
That’s it, pretty easy when you think about it, but I’ve found it saves me several minutes per form, which adds up over the course of the form design phase of an Access project.