Online Book Reader

Home Category

Access Cookbook - Ken Getz [168]

By Root 2104 0
of forms that include unbound graphic controls or bound controls that hold OLE or memo fields:

Open the problem form in design view. If you have any unbound object frame controls (also know as unbound OLE controls) that are used to store fixed graphic images, change them to image controls by right-clicking on the object and selecting Change To Image (see Figure 8-7). The frmCategoriesStep1 form in the 08-02a.MDB sample database is identical to frmCategoriesOriginal except that ctlLogo has been converted from an unbound object frame control to an image control.

Figure 8-7. Changing an unbound object frame control to an image control

If you created a watermark for the form, consider removing it. To do this, select the word "bitmap" in the form's Picture property, press the Del key, and answer Yes to the confirming dialog. The frmCategoriesStep2 form in 08-02a.MDB is identical to frmCategoriesStep1, except that we deleted the watermark.

If your form contains any bound controls that hold either OLE or memo fields, consider moving the controls to a second page of the form. In the final version of the Categories form, named frmCategoriesStep3 (Figure 8-6), we moved the ctlDescription and ctlPicture controls to a second page.

Combo and list box controls


Load the 08-02b.MDB database. Open the frmSurveySlow form. This form contains a combo box control, cboPersonId, that has as its row source a SQL Select statement that pulls in 15,000 rows from the tblPeople table. Load time for the form is slow because Access has to run the query that supplies the 15,000 rows to cboPersonId. Tab to the cboPersonId control and type "th" to search for the name "Thompson, Adrian" (see Figure 8-8).

Figure 8-8. The cboPersonId combo box in frmSurveySlow is very slow

Note the long delay before the "th" list of records appears. Now open the frmSurveyFast form (see Figure 8-9); its load time is significantly faster. Press the ">" command button to open the frmPersonPopup form. Type "th" in the first field and press Tab.

Figure 8-9. In frmSurveyFast, the combo box is replaced with a text box and command button

After a short delay, you'll be able to select "Thompson, Adrian" from the drop-down list as shown in Figure 8-10. Press the OK button, which will drop the chosen name back into the txtPersonName text box on frmSurveyFast.

Figure 8-10. Selecting a name from the drop-down list is much faster

Follow these steps to improve the speed of forms containing combo or list boxes that must display a lot of information:

Make a copy of the problem form and open the copy in design view. Select the slow combo or list box control. Right-click on the control and select Change To → Text Box.

Create a new unbound pop-up form with the property settings shown in Table 8-2. Leave the remaining property settings at their defaults. In the sample database, this form is named frmPersonPopup.

Table 8-2. Property settings for the pop-up form

Property

Setting

ScrollBars

Neither

RecordSelectors

No

NavigationButtons

No

AutoResize

Yes

AutoCenter

Yes

PopUp

Yes

Modal

Yes

MinMaxButtons

None

Create four unbound controls on this form: a text box, a combo box, and two command buttons. In the sample database, we created the controls shown in Table 8-3. The text box will be used to limit the number of items in the combo box, using the parameter query created in Step 4.

Table 8-3. The controls on frmPersonPopup

Control type

Control name

Notes

Text box

txtChar

Limits the values in the row source of the combo box

Combo box

cboPersonId

Uses the parameter query created in Step 4 as its row source

Command button

cmdOK

Hides form

Command button

cmdCancel

Closes form

Create a new query that will serve as the row source for the combo box of the pop-up form. If you used a query as the source for the combo or list box on the original form, you should be able to modify its design. Add the necessary fields to the query. Add a parameter to the form that limits the rows based on a value

Return Main Page Previous Page Next Page

®Online Book Reader