Part IV: Professional Database Development
860
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
l (^) 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.
l (^) 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.
l 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 vari-
ables 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”.
l 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 proce-
dures 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.
l (^) Not overlapping controls on a form or report.
l 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.
l 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).
Using bitmaps on forms and reports
Bitmaps on forms and reports make an application look attractive and can also help convey the
purpose of the form or report (as in a wizard). However, graphics are always resource-intensive, so
you should use the fewest possible number of graphic objects on your forms and reports. This
helps to minimize form and report load time, increase print speed, and reduce the resources used
by your application.
Often you’ll display pictures that a user never changes and that are not bound to a database.
Examples of such pictures include your company logo on a switchboard or static images in a wiz-
ard. When you want to display images like these, you have two choices: