Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

ACC2000: How to Set Defaults for the Find and Replace Dialog Box


View products that this article applies to.

Summary

This article describes how to set different default settings for the Find and Replace dialog box in Microsoft Access 2000.

↑ Back to the top


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
				

↑ Back to the top


References

For 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.

↑ Back to the top


Keywords: KB208923, kbinfo, kbhowto

↑ Back to the top

Article Info
Article ID : 208923
Revision : 2
Created on : 6/28/2004
Published on : 6/28/2004
Exists online : False
Views : 275