4. Click the Builder button that appears in the right side of the property.
The procedure appears in a separate VBA code window. The shell of the event procedure
(Private Sub cboQuickSearch_AfterUpdate()...End Sub) is automatically
created. As you have learned, whenever you create an event procedure, the name of the
control and event are part of the subprocedure.
5. Enter the four lines of code exactly as shown in Figure 27-4.
FIGURE 27-4
Using the FindRecord method to find a record
The first line is:
txtProductID.SetFocus
This statement moves the cursor to the txtProductID control. Just as you need to manually move
the cursor to a control in order to use the Find icon in the Access ribbon, you must place the cursor
in the control. In this case, you??™re moving the cursor to the control containing the ProductID
value because the search will look for a particular ProductID.
The next block of code is:
If Not IsNull(cboQuickSearch.Value) Then
DoCmd.FindRecord cboQuickSearch.Value
End If
This block of code first checks to make sure that cboQuickSearch contains a value (is not null)
before using the FindRecord method.
Pages:
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648