ACC95: FindNext Does Not Advance to Next Record to Search (150665)
The information in this article applies to:
- Microsoft Access for Windows 95 7.0
This article was previously published under Q150665 SYMPTOMS
When the FindNext macro action is run from a command button on a form to
find the next instance of the search criteria specified by the previous
FindRecord action, the first instance is found repeatedly. The FindNext
macro action fails to advance to the next record to find the next instance
of the search criteria.
NOTE: The same behavior can be demonstrated using the FindRecord macro
action with the FindFirst argument set to No.
CAUSE
Microsoft Access for Windows 95 and Microsoft Access version 2.0 behave
differently in regard to where the FindNext macro action begins the
search for the next instance of the search criteria.
The FindNext action in Microsoft Access version 2.0 always begins
searching starting with the next record in the recordset. In Microsoft
Access for Windows 95, if the currently selected text is the same as the
search text at the time the FindNext macro action is invoked, the search
begins immediately following the selection in the same field as the
selection, and in the same record. Otherwise, it begins searching at the
start of the current record.
The advantage to the Microsoft Access for Windows 95 behavior is that
you can repeatedly find multiple instances of the same search criteria
that might appear in a single record. The FindNext macro action in
Microsoft Access version 2.0 is limited to finding only the first instance
of the search criteria in a record, regardless of other instances of the
same search criteria in the record.
The problem occurs in Microsoft Access for Windows 95 when you push a
custom Find Next command button on a form. When this happens, focus
moves from the current control to the button. If text is selected in the
current control, it will not remain selected when the focus moves to the
button. The FindNext action will then begin searching from the start of the
record because the current selection is no recognized. The first
instance of the search criteria will be found repeatedly in the same
record.
RESOLUTION
Use one of the following techniques to work around this behavior:
- Use a different mechanism to invoke the FindNext action that allows
focus to remain in the current control. This can be accomplished in
one of the following ways:
- Use a custom Toolbar button rather than a command button.
- Use a function key or keystroke invoked by a AutoKeys macro.
- Use Visual Basic code to reset focus back to the control that
contains the selection before invoking the FindNext macro action.
For a detailed discussion of how to implement these techniques, please see
the "Workaround" sections following the "More Information" section.
Modification Type: | Major | Last Reviewed: | 11/17/2000 |
---|
Keywords: | kbprb kbusage KB150665 |
---|
|