Part IV: Professional Database Development
886
FIGURE 25.5
Using a RecordsetClone bookmark to find a record
The Recordset object’s FindFirst method requires a search string containing criteria to look
up in the recordset. (Yes, that’s correct — you’re actually asking the RecordsetClone to search
itself for a record, based on some criteria.)
The criteria string can be as complicated as needed. The following statement concatenates
“[ProductID] = “ with the value of cboQuickSearch:
strCriteria = “[ProductID] = “ & cboQuickSearch.Value
The value of Me!cboQuickSearch is then added to the string. Assuming the value of cbo-
QuickSearch is 17 , strCriteria is now
[ProductID] = 17
Note
The criteria string works only because ProductID is a numeric field. If it were text, quotes would be required
around the value, as in
strCriteria = “[ProductID] = ‘“ & Me!cboQuickSearch.Value & “‘“
so that the criteria would actually be
[ProductID] = ‘17’