Capture when Esc Key is used

We are developing a generic mail template for departmental/groups to email information and using the Mail-In database name as the “spoof” name in the principal and from field. The basis of the design is the StdR6Mail template. We have a requirement that we are not allowed to write to mail.box, so the messages do not actually get “Sent”. They are saved in the database and acted upon by an agent.

The design of the form requires that we set a SaveOptions field to “1” and a MailOptions field to “0”. The result is that when a user selects the ESC key, the document is saved in the draft view without prompting them. The problem is that we will have frantic users that will not know what happened to their document, no matter how much training we go through!

We want to capture that the user has hit ESC and then prompt them with what they would like to do with the document.

I’ve searched this forum/other forums and the FAQ, and I’ve even tried using the Windows API to capture the key(I’m not well versed with the API so I didn’t have luck there).

It appears that most people who have had a similiar need have used a field on a form as a “Toggle” and set that field in the action buttons and check it’s value on Queryclose. Before I went that route I wanted to see if anyone is aware of an alternative?

Thanks in advance for any assistance!

Subject: Capture when Esc Key is used

Here’s some code I found a few years ago; never tested, but it might help you.

I had a similar need, I wanted to force the user to click the ‘Close’ button, instead of allowing ‘ESC’.

The only way I found to trap for the ESC key is this:

Create a field on the form (I called mine ‘CloseButton’) - Computed. Value is ‘CloseButton’.

Then in my Close button, I assign the CloseButton field a value.

In my QueryCloseEvent, i check the value of the button:

If source.EditMode Then

If doc.CloseButton(0) = “” Then

reply% = Messagebox (“Do you really want to exit without saving”, 52, “Cancel Send ?”)

If reply% = 7 Then

continue = False

End If

End

End If

End If