find and replace popup on on open

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How can I force the "find and replace" window to appear when a form is
opened? I'm using this form specifically to search data so I would like to
eliminate the step of clicking on a button to make the find and replace tool
appear. Any help will be appreciated!
 
The following code will open the find/replace menu form:
DoCmd.RunCommand acCmdReplace

The tricky bit is where to put this code. If it tries to run when there is
nothing available for the find/replace action, you get an error message.
This situation occurs at form open, form activate, form load, etc. It will
work if you put it in the GotFocus event of a textbox which gains focus when
the form is opened (this will be the first control in the tab order of the
detail section of the form). However, putting the code in that event also
means that the find/replace form will appear whenever you move to that
textbox while the form is open. Maybe that's acceptable; if not you could
add some additional code to set a flag so that the code will only run once
when the form opens.

HTH,

Rob
 
Back
Top