The techniques described in this chapter greatly extend the utility of Access forms and empower
users to quickly look up data without having to learn the built-in filtering and searching features
of Access forms.
876
Professional Database Development Part IV
Using the With Keyword
The With keyword is used to save time by not referencing the controls on the form explicitly
(which means directly): for example, Forms!frmProductsExample4.SetFocus. This requires Access
to search alphabetically through the list of forms in the database container. If there are 500 forms
(and some large systems have this many or more) and the form name started with z, this would take
a measurable amount of time. Because there is more than one reference to the form, this would have
to take place multiple times. The With command sets up an internal pointer to the form so that all
subsequent references to the form control or property or to use a form method (like Requery or
SetFocus) are much faster.
When you use the With keyword and reference the form name, you simply use a dot (.
Pages:
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663