PDA

View Full Version : Solved: Resetting "Find and Replace" Defaults



MWE
03-28-2005, 12:33 PM
The Find and Replace window in Access has several options, each option has a default. I want to change the Match option from Whole Field to Any Part of Field. I would prefer to do this via some mysterious Options setting, but a line or two of VBA code would work just as well.

Thanks

geekgirlau
03-29-2005, 07:49 PM
Actually there is an option setting. Under Tools, Options, Edit/Find you can set the Default find/replace behaviour - the setting you want is "General search".

To do this via code,

Application.SetOption "Default Find/Replace Behavior", 1

MWE
03-29-2005, 09:09 PM
many thanks. Using the Tools | Options approach is great for now.

MWE
03-31-2005, 05:33 AM
After a little testing, I have to downgrade my rating from great to good. The option change works, and I thank you for pointing it out to me, but it also does something that I do not want -

The (original default) "Fast Search" searchs the selected field (Look In: = selected field) across all records for the all of the desired "text" (Match: = Whole Field).

The suggested "General Search" searches the entire table (Look In: = table) for any instance of the desired text (Match := Any Part of Field).

What I really want is a search method that defaults to:
Look In: = selected field
Match: = Any Part of Field

Any thoughts on how this can be done?

Thanks

geekgirlau
03-31-2005, 08:04 AM
Hmmm :think:

I can't find any other option that sets the default in the Find box. There is a "FindRecord" method and action (macros) that has a "Match" parameter - if you set this to "acAnywhere" with the "OnlyCurrentField" parameter set to "acCurrent", this will give you what you want. However this would require that you create your own custom search form that is launched when you press Ctrl-F, and that you customise the menu bar to replace the Edit/Find option.

There would be a bit of work involved - do you feel lucky? :dau:


DoCmd.FindRecord Me.txtSearch, acAnywhere, False, , True, acCurrent

MWE
03-31-2005, 08:27 AM
Hmmm :think:

I can't find any other option that sets the default in the Find box. There is a "FindRecord" method and action (macros) that has a "Match" parameter - if you set this to "acAnywhere" with the "OnlyCurrentField" parameter set to "acCurrent", this will give you what you want. However this would require that you create your own custom search form that is launched when you press Ctrl-F, and that you customise the menu bar to replace the Edit/Find option.

There would be a bit of work involved - do you feel lucky? :dau:


DoCmd.FindRecord Me.txtSearch, acAnywhere, False, , True, acCurrent

creating custom forms and modding menu bars is within my skill level - I do lots of this in other MS appls. The " ... do you feel lucky?" is worrisome.:rofl: I will play around with this an IM you with results.

geekgirlau
03-31-2005, 02:09 PM
Actually I don't think it will be too difficult, just a lot of work to duplicate a built-in function because you cannot set the :censored: defaults! However think of this as a learning exercise and try to avoid the temptation to swear under your breath (or extremely loudly) at Microsoft.