Find and replace function

tebule

Registered User.
Local time
Today, 06:55
Joined
Oct 8, 2008
Messages
38
I have added a button on my form that looks in a specific fields and allows the user to search my form. Problem is when the find/replace pop-up window no long has the focus, it changes the "Look in" option to Main Menu. I would like to close the form once it has lost focus. Anyone know how to do that?
I found an api that I can use to cycle through the open windows to pull window caption and from that I can find the window handle and close it. But I was hoping for a better, smoother solution. My code for the find/replace is:
Code:
Private Sub cmdFindTicker_Click()
On Error GoTo Err_cmdFindTicker_Click
 
Me.Ticker_Symbol.SetFocus
Me.AllowEdits = False 'Suppress REPLACE tab
DoCmd.RunCommand acCmdFind
Me.AllowEdits = True 'Restore state
Exit_cmdFindTicker_Click:
Exit Sub
Err_cmdFindTicker_Click:
Me.AllowEdits = True
MsgBox Err.Description
Resume Exit_cmdFindTicker_Click
 
End Sub
I am grateful for any help!
 

Users who are viewing this thread

Back
Top Bottom