in the form, a command button executes a query when clicked.
I want to close the result window with ESC key press in the keyboard.
i dont want to click on the close of that window.
pls help me if it is possible and how can i do it.
You can't. If you're opening a query and not a form, you cannot trap
for any events. You can close any window inside Access by using CTRL-
F4 while the object has focus.
then can we close with esc keypress to close form ??
"pietl...@hotmail.com" wrote:
> .
>
Open the form in design view and set the KeyPreview property of the form to
True.
Then add this code to the form's code module:
Private Sub Form_KeyPress(KeyAscii As Integer)
'NOTE: this is a really weird use of ESC!!!
' Some users may find this confusing!!!
Const ESC_KEY As Integer = 27
If KeyAscii = ESC_KEY Then
DoCmd.Close acForm, Me.Name
End If
End Sub
--
Message posted via http://www.accessmonster.com
thank you very much .....:)
"PieterLinden via AccessMonster.com" wrote:
> .
>