CTRL-S on a form

  • Thread starter Thread starter Ryan Cauchi-Mills
  • Start date Start date
R

Ryan Cauchi-Mills

How can you use CTRL-S to fire a save record event on a form when Access
intercepts this keystroke for it's own save form object purposes?
 
Ryan Cauchi-Mills said:
How can you use CTRL-S to fire a save record event on a form when
Access intercepts this keystroke for it's own save form object
purposes?

You don't want to use the normal Shift+Enter key combination? You can
capture the Ctrl+S combination for your own use, I think, by setting the
form's KeyPreview property to Yes and setting up an event procedure like
the following for the form's KeyDown event:

' ------ WARNING: air code without error-handling ------
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)

If KeyCode = vbKeyS And Shift = acCtrlMask Then
RunCommand acCmdSaveRecord
KeyCode = 0
End If

End Sub

' ------ end air code ------
 
How can you use CTRL-S to fire a save record event on a form when Access
intercepts this keystroke for it's own save form object purposes?

Use Ctrl-Enter instead (the builtin hotkey for saving a record), or
use the Form's KeyPreview event to trap the Ctrl-S if users insist on
using that particular hotkey.
 
Back
Top