well sorry i've only ever used one macro autoexec in access ver 2, but i've checked the help file and {esc} is correct but is access expecting to get a esc at the point your using it?? and can you use code to do what you want??
for the form set the "events" tab set the Key Preview to yes
add this to the code module and the "Esc" key will close the form.
Private Sub Form_KeyPress(KeyAscii As Integer)
If KeyAscii = 27 Then
DoCmd.Close
End If
End Sub
the "Esc" key is also used by access to undo an edit another approch is to add a command button to the form set the caption to E&xit this will allow the user to use the key combination "Alt" "x" to close the form. i usually use
E&xit as it's more in line with windows
Private Sub ClsFrm_Click()
On Error GoTo Err_ClsFrm_Click
' close this form
DoCmd.Close
Exit_ClsFrm_Click:
Exit Sub
Err_ClsFrm_Click:
MsgBox Err.Description
Resume Exit_ClsFrm_Click
End Sub
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.