Consulting

Results 1 to 7 of 7

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

Posting Permissions

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