Results 1 to 4 of 4

Thread: shortcut keys

  1. #1
    Join Date
    Apr 2004
    Location
    Bucharest, Romania
    Posts
    16

    Question Unanswered: shortcut keys

    HI,

    There is a way to program some shortcuts keys for a form in Access 2002? ex: F5 for save the record, F6 for preview report , etc.

  2. #2
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1

    Lightbulb

    * You have to enable KeyPreview of your main form also on every form in your application

    * Check each pressed key as follow
    PHP Code:
      Private Sub Form_KeyDown(KeyCode As IntegerShift As Integer)
        If 
    KeyCode vbKeyF5 Then
          MsgBox 
    "F5 was pressed"vbInformation
        End 
    If
    End Sub 

  3. #3
    Join Date
    May 2004
    Posts
    6
    Quote Originally Posted by dny
    HI,

    There is a way to program some shortcuts keys for a form in Access 2002? ex: F5 for save the record, F6 for preview report , etc.
    Code:
    Private Sub Form_Load()
    
        Me.KeyPreview = True
        
    End Sub
    
    
    
    
    
    Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
        
        Select Case KeyCode
            Case vbKeyF5
                DoCmd.RunCommand acCmdSaveRecord
                
            Case vbKeyF6
                DoCmd.OpenReport "YourReport", acViewPreview
                
            Case Else
        
        End Select
    
    End Sub
    HTH

  4. #4
    Join Date
    Apr 2004
    Location
    Bucharest, Romania
    Posts
    16
    Quote Originally Posted by ___
    Code:
    Private Sub Form_Load()
    
        Me.KeyPreview = True
        
    End Sub
    
    
    
    
    
    Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
        
        Select Case KeyCode
            Case vbKeyF5
                DoCmd.RunCommand acCmdSaveRecord
                
            Case vbKeyF6
                DoCmd.OpenReport "YourReport", acViewPreview
                
            Case Else
        
        End Select
    
    End Sub
    HTH
    Thanks a lot. I had no ideea about Key Preview.
    dny

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •