ACC2000: How to Set Defaults for the Find and Replace Dialog Box (208923)
The information in this article applies to:
This article was previously published under Q208923 Moderate: Requires basic macro, coding, and interoperability skills.
This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).
SUMMARY
This article describes how to set different default settings for the Find and Replace dialog box in Microsoft Access 2000.
MORE INFORMATION
When you click Find on the Edit menu in Form view, the Find and Replace dialog box appears with the following default settings:
Find What: <clear> Look In: current field
Match: Whole Field Search: All
Match Case: <clear>
Search Fields As Formatted: <clear>
To alter these settings, start the Find and Replace dialog box with the RunCommand and use the SendKeys action to select alternate settings. For example, you can start the Find and Replace dialog box by using a macro with the following actions:
Action Action Argument
------------------------------
SendKeys Keystrokes: %ha%n
Wait: No
RunCommand Command: Find
This macro can then be assigned to a command button, a button on a form,
or to an event on a form. When you run this macro, the Find and Replace dialog box appears with Any Part Of Field selected in the Match box. The keystrokes sent by the SendKeys action are as follows:
- ALT+H to select the Match box setting
- "a" to select Any Part Of Field setting
- ALT+N to select the Find What box
The SendKeys action must come before the call to open the dialog box, even
though it may seem that the call to open the dialog box should come
first. However, if you place the call to open the dialog box first, the
macro runs the RunCommand action and then waits for the dialog box to be
closed before continuing to the next action (the SendKeys action), sending
your keystrokes to the form.
The following table lists which keystrokes to send to select various items
in the Find and Replace dialog box:
Option Setting Keystrokes
-----------------------------------------------------------
Match Any Part of Field %ha
Match Start of Field %hs
Match Case <selected> %c
Search Fields as Formatted <selected> %o
Search Up %su
Search Down %sd
You can combine these keystrokes to make multiple selections. For example,
the following actions open the Find and Replace dialog box with Start Of Field selected in the Match box; select Up in the Search box; and set the focus to the Find What box:
Action Action Argument
------------------------------
SendKeys Keystrokes: %hs%su%n
Wait: No
RunCommand Command: Find
REFERENCESFor more information about the Find and Replace command, click Microsoft Access Help on the Help menu, type find specific occurrences of a value in a field in the Office Assistant or the Answer Wizard, and then click Search to view the topic.
For more information about the SendKeys action, click Microsoft Access Help on the Help menu, type sendkeys action in the Office Assistant or the Answer Wizard, and then click Search to view the topic.
For more information about running macros, click Microsoft Access Help on the Help menu, type run a macro in the Office Assistant or the Answer Wizard, and then click Search to view the topic.
Modification Type: | Major | Last Reviewed: | 6/28/2004 |
---|
Keywords: | kbhowto kbinfo KB208923 |
---|
|