Moderate: Requires basic macro, coding, and interoperability skills.
MORE INFORMATION
When you click
Find on the
Edit menu in Form view, the
Find dialog box appears with the following default settings.
In Access versions In version 7.0 and Access 97
1.0, 1.1, and 2.0
------------------------------- ------------------------------
Where: Match Whole Field Search: All
Search In: Current Field Match: Whole Field
Match Case: <clear> Match Case: <clear>
Search Fields As Formatted: <clear> Search fields as formatted: <clear>
Direction: Down Search only current field: <checked>
Method 1
In version 7.0 and Access 97, you can change these settings through the Edit/Find tab of the
Options dialog box. To modify the settings through the
Options dialog box, follow these steps:
- On the Tools menu, click Options and then click the Edit/Find tab.
- Under the "Default Find/Replace Behavior" section, change the option buttons to reflect the default behavior that you want.
The settings for each Search option are listed below.
Fast Search
In version 7.0 and Access 97
------------------------------
Search: All
Match: Whole Field
Match Case: <clear>
Search fields as formatted: <clear>
Search only current field: <checked>
General Search
In version 7.0 and Access 97
------------------------------
Search: All
Match: Any Part of Field
Match Case: <clear>
Search fields as formatted: <Not Available>
Search only current field: <clear>
Start of Field Search
In version 7.0 and Access 97
------------------------------
Search: All
Match: Start of Field
Match Case: <clear>
Search fields as formatted: <clear>
Search only current field: <checked>
Method 2
You can also change these settings by invoking the
Find dialog box with the DoMenuItem action (or RunCommand in Access 97) by using the SendKeys action to select different settings. For example, you can invoke the
Find dialog box by using a macro with the following actions:
In Access 97:
SendKeys
Keystrokes: %ha%n
Wait: No
RunCommand
Command: Find
In Access versions 2.0, 1.0, and 1.1, and in version 7.0:
SendKeys
Keystrokes: %ha%n
Wait: No
DoMenuItem
MenuBar: Form
MenuName: Edit
Command: Find
This macro can then be assigned to a command button, to a button on a form,
or to an event on a form. When you run this macro, the
Find dialog box appears with
Any Part Of Field selected in the Match box (or Where box in versions 2.0, 1.0, and 1.1). The keystrokes sent by the SendKeys action are:
- ALT+H to select the Match box
- "a" to select Any Part Of Field
- and ALT+N to select the Find What box
The SendKeys action must come before the call to open the dialog box, although it may seem that the call to open the dialog box must come
first. However, if you put the call to open the dialog box first, the
macro runs the RunCommand action and then waits for the dialog box to
close before the macro then continues to the next action (the SendKeys action). The SendKeys action sends your keystrokes to the form.
The following table lists the keystrokes to send to select various items
in the
Find dialog box.
In Access 97 and version 7.0:
Option Setting Keystrokes
-----------------------------------------------------------
Match Any Part of Field %ha
Match Start of Field %hs
Search Only Current Field <cleared> %e
Match Case <selected> %c
Search Fields as Formatted <selected> %o
Search Up %ru
Search Down %rd
In Access versions 2.0, 1.0, and 1.1:
Option Setting Keystrokes
-----------------------------------------------------------
Where Any Part Of Field %ha
Where Start Of Field %hs
Search In All Fields %l
Match Case <selected> %s
Search Fields As Formatted <selected> %o
Direction Up %u
You can combine these keystrokes to make multiple selections. For example,
the following actions open the
Find dialog box with
Start Of Field selected in the Match box. Then, the actions clear the
Search Only Current Field box (or select the
All Fields option in version 2.0). And then the actions select
Up in the Search.
In Access 97:
SendKeys
Keystrokes: %hs%e%ru%n
Wait: No
RunCommand
Command: Find
In Access versions 2.0, 1.0, and 1.1, and version 7.0:
SendKeys
Keystrokes: %hs%e%ru%n (%hs%l%u%n in version 2.0 and 1.x)
Wait: No
DoMenuItem
MenuBar: Form
MenuName: Edit
Command: Find