Optimize form and subform performance
There are several things you can do to make your forms run faster. If you’re using a Microsoft Access database, you can use the Performance Analyzer to analyze specific forms in your database in addition to the following tips. For information on using the Performance Analyzer, click .
Performance Tips
- Avoid overlapping controls.
- Use bitmaps and other graphic objects sparingly.
- Convert unbound object frames that display graphics to image controls.
- Use black-and-white rather than color bitmaps.
- Close forms that aren't being used.
- If the underlying record source includes many records and you want to use the form primarily to enter new records, set the DataEntry property of the form to Yes so that the form opens to a blank record. If you open a form with all records showing, Microsoft Access has to read in each record before it can display the blank record at the end of the recordset.
- Don't sort records in an underlying query unless record order is important, especially with multiple-table queries.
- Base subforms on queries rather than on tables, and include only fields from the record source that are absolutely necessary. Extra fields can decrease subform performance.
- Index all the fields in the subform that are linked to the main form.
- Index any subform fields that are used for criteria.
- Set the subform's AllowEdits, AllowAdditions, and AllowDeletions properties to No if the records in the subform aren't going to be edited. Or set the RecordsetType property to Snapshot.
- Eliminate code from forms that don't need it by setting the HasModule form property to No. The HasModule property specifies whether the form has a form module. A form without a form module loads more quickly and occupies less disk space. If a form or controls on the form don't use event procedures, the form doesn't require a form module. For example, if your application uses a switchboard form exclusively to navigate to other forms, instead of using command buttons with event procedures, you can use command buttons with macros, or hyperlinks. You can still use code with a form that has no form module by calling Function procedures from a standard module using an expression. (You can't use Sub procedures, because they can't be called using an expression.) To do this, define a Function procedure in a standard module and then call that function from an event property of the form or a control. For example, to use a command button to call a function to open a form, add an expression to the OnClick property of the command button like this: =OpenDataEntry().
Note If a form currently contains event procedures, and you decide to eliminate all event procedure code from that form, you must set the HasModule property to No to completely remove the form module.