Getting the most from your forms and reports
Forms and reports can slow an application by taking a long time to load or process information. You can perform a number of tasks to increase the performance of forms and reports.
Minimizing form and report complexity and size
One of the key elements to achieving better performance from your forms and reports is reducing complexity and size, which you can accomplish by
- Minimizing the number of objects on a form or report: The fewer objects used, the fewer resources needed to display and process the form or report.
- Reducing the use of subforms: When a subform is loaded, two forms are in memory - the parent form and the subform. Use a list box or a combo box in place of a subform whenever possible.
- Using labels instead of text boxes for hidden fields because text boxes use more
resources than labels do. Hidden fields are often used as an alternative to creating variables
to store information. (Remember, though, that you cannot use labels as parameters for queries.)
Tip: You can't write a value directly to a label like you can to a text box, but you can write to the labels caption property using VBA like this:Label1.Caption = "MyValue"
. - Moving some code from a form's module into a standard module: This enables the form to load faster because the code doesn't need to be loaded into memory. If the procedures that you move to a normal module are referenced by any procedures executed upon loading a form (such as in the form load event), moving the procedures won't help because they're loaded anyway as part of the potential call tree of the executed procedure.
- Not overlapping controls on a form or report.
- Placing related groups of controls on form pages: If only one page is shown at a time, Access doesn't need to generate all the controls at the same time.
- Using a query that returns a limited result set for a form or report's RecordSource rather than using a table or underlying query that uses tables: The less data returned in the RecordSource, the faster the form or report loads. In addition, you should return only those fields actually used by the form or report. Don't use a query that gathers fields that won't be displayed on the form or report (except for a conditional check).
In this tutorial:
- Optimizing Access Applications
- Understanding Module Load on Demand
- Using the .accdb Database File Format
- Distributing .accde Files
- Understanding the Compiled State
- Application's code into a compiled state
- Distributing applications in a compiled or uncompiled state
- Creating a library reference for distributed applications
- Improving Absolute Speed
- Getting the most from your tables
- Getting the most from your queries
- Getting the most from your forms and reports
- Using bitmaps on forms and reports
- Getting the most from your modules
- Using control variables
- Eliminating dead code and unused variables
- Improving Perceived Speed
- Loading and keeping forms hidden
- Speeding up the progress meter display
- Working with Large Access Databases
- Recognizing that compiling and compacting
- Using the decompile option
- Detecting an uncompiled database and automatically recompiling