Consulting

Results 1 to 8 of 8

Thread: Solved: Resetting "Find and Replace" Defaults

  1. #1
    VBAX Expert
    Joined
    Feb 2005
    Posts
    929
    Location

    Solved: Resetting "Find and Replace" Defaults

    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

  2. #2
    VBAX Master geekgirlau's Avatar
    Joined
    Aug 2004
    Location
    Melbourne, Australia
    Posts
    1,464
    Location
    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,
    [VBA]
    Application.SetOption "Default Find/Replace Behavior", 1
    [/VBA]

  3. #3
    VBAX Expert
    Joined
    Feb 2005
    Posts
    929
    Location
    many thanks. Using the Tools | Options approach is great for now.

  4. #4
    VBAX Expert
    Joined
    Feb 2005
    Posts
    929
    Location
    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

  5. #5
    VBAX Master geekgirlau's Avatar
    Joined
    Aug 2004
    Location
    Melbourne, Australia
    Posts
    1,464
    Location
    Hmmm

    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?

    [VBA]
    DoCmd.FindRecord Me.txtSearch, acAnywhere, False, , True, acCurrent
    [/VBA]

  6. #6
    VBAX Expert
    Joined
    Feb 2005
    Posts
    929
    Location
    Quote Originally Posted by geekgirlau
    Hmmm

    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?

    [VBA]
    DoCmd.FindRecord Me.txtSearch, acAnywhere, False, , True, acCurrent
    [/VBA]
    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. I will play around with this an IM you with results.

  7. #7
    VBAX Master geekgirlau's Avatar
    Joined
    Aug 2004
    Location
    Melbourne, Australia
    Posts
    1,464
    Location
    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 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.

  8. #8
    By changing the Access Options Client Settings 'Find/Replace Default' from 'Fast Search' to 'General Search', the value 'Search in:' in the search box is automatically set from 'Current field' to 'Current document'.
    To set the default setting of the search function to 'Current field'/'Part of the field content', I recommend setting the registry entry '\HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Access\Settings\Default Find/Replace Behavior' to 4.
    For clients that do not have a complete Access installation on their computer, this value must be created again.
    Marco Bracher

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •