Hi all,
maybe I am going about this the wrong way, if so I would appreciate some advice.
I have a popup form (frmSearchPubs) with a field (txtTitle) in which I enter a string to be used as the criteria for a record set to be displayed in another form. After the users enters the string they had to press the Enter key twice to activate the command button (btnSearch) that triggers the code to produce the filtered recordset.
I was asked to modify the procedure so that users had to press the Enter key only once so I put the same code that's on btnSearch on the OnExit event of txtTitle. Naturally the code is also triggered if I click on btnCancel if I want to cancel the search procedure.
I thought that if I could put in the OnExit event some code that can identify which button was clicked or activated I could then direct the code to do different things such as (the following code does not activate the procedure, but is used for testing purposes only):
If Screen.ActiveControl.Name = "btnCancel" Then
MsgBox "Cancel is pressed"
Else
MsgBox "Find is pressed"
End If
This does not work, I keep on getting "Find is pressed" no matter how I exit from txtTitle. Any ideas?
thanks
Dave
maybe I am going about this the wrong way, if so I would appreciate some advice.
I have a popup form (frmSearchPubs) with a field (txtTitle) in which I enter a string to be used as the criteria for a record set to be displayed in another form. After the users enters the string they had to press the Enter key twice to activate the command button (btnSearch) that triggers the code to produce the filtered recordset.
I was asked to modify the procedure so that users had to press the Enter key only once so I put the same code that's on btnSearch on the OnExit event of txtTitle. Naturally the code is also triggered if I click on btnCancel if I want to cancel the search procedure.
I thought that if I could put in the OnExit event some code that can identify which button was clicked or activated I could then direct the code to do different things such as (the following code does not activate the procedure, but is used for testing purposes only):
If Screen.ActiveControl.Name = "btnCancel" Then
MsgBox "Cancel is pressed"
Else
MsgBox "Find is pressed"
End If
This does not work, I keep on getting "Find is pressed" no matter how I exit from txtTitle. Any ideas?
thanks
Dave