Find And Replace Button on a form

TJBernard

Registered User.
Local time
Today, 20:56
Joined
Mar 28, 2002
Messages
176
This is a little tricky, I am using a the MS Access Find and Replace function on a form, so that once a user clicks a buttong, the Find And Replace pop-up dialog opens and tries to Find or Replace the field that was set to the focus when the button was clicked.

Here is the code I am using:
Docmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70

This is working great, but the user wants the Find and Replace to open up with the Match Case = Any Part of Field. The default Match Case = Whole Field. Does anyone know if there is a way to change the Match Case = Any Part of Field through code?

Thank you in advance.

T.J.
 
You would have to use SendKeys to do that. I recommend not using SendKeys for I have had problems closing the db after using SendKeys. I used to use SendKeys for exactly what you want (with the Find dialog) and every time I tried to close the db, the db would close but Access was still open and I had to CtrlAltDel to kill it.

But if you want to try it, this is what I used in Access 97...

Me.TextBox1.SetFocus 'change this to be the primary field for searching
SendKeys "%ra%ha%c-1%n", False 'Send Key options (Alt + ?) with parameter controls
'DoCmd.RunCommand acCmdFind
DoCmd.RunCommand acCmdReplace

HTH
 
Thank you very much I will give it a shot

T.J.
 
From the Microsoft site, follow the following:
  1. On the Tools menu, click Options.
  2. Click the Edit/Find tab.
  3. Under Default find/replace behavior, do one of the following: Select Fast Search to search the current field and match the whole field.
    Select General Search to search all fields and match any part of the field.
    Select Start Of Field Search to search the current field and match the beginning characters of the field.
Note Changes made to this setting don't take effect until the next time you start Microsoft Access.
081018EWC
 

Users who are viewing this thread

Back
Top Bottom