Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to close the result window with ESC

2 views
Skip to first unread message

naveen prasad

unread,
Jan 30, 2010, 1:39:01 PM1/30/10
to
Hi

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.

pietl...@hotmail.com

unread,
Jan 31, 2010, 12:49:47 AM1/31/10
to
On Jan 30, 12:39 pm, naveen prasad

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.

naveen prasad

unread,
Jan 31, 2010, 2:24:02 AM1/31/10
to
Is it possible if we create form based on query,

then can we close with esc keypress to close form ??

"pietl...@hotmail.com" wrote:

> .
>

PieterLinden via AccessMonster.com

unread,
Jan 31, 2010, 6:12:09 AM1/31/10
to
naveen prasad wrote:
>Is it possible if we create form based on query,
>
>then can we close with esc keypress to close form ??
>
>> On Jan 30, 12:39 pm, naveen prasad
>> <naveenpra...@discussions.microsoft.com> wrote:
>[quoted text clipped - 12 lines]

>> F4 while the object has focus.
>> .

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

naveen prasad

unread,
Feb 2, 2010, 2:19:01 AM2/2/10
to
wow excellent it really worked....

thank you very much .....:)


"PieterLinden via AccessMonster.com" wrote:

> .
>

0 new messages