Results 1 to 6 of 6
  1. #1
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919

    Override use of function key F1

    Is there a way in the form properties to give control to my KeyDown event procedure when F1 is pressed? As it is, I get Access help menu.

  2. #2
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    google found a number of threads on the subject - here is one

    https://bytes.com/topic/access/answe...-function-keys

  3. #3
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919
    Thanks. I stumbled onto the KeyPreview property while I was searching. Setting that property for the form to YES does the trick. One needs an AutoKeys macro when the situation applies to an entire app.

  4. #4
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919
    One does have to set KeyCode = 0 to avoid futher "default" processing.

    Code:
    Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    
    If KeyCode = vbKeyF1 Then
        KeyCode = 0
        MsgBox "Testing F1 for other than default use."
    End If
    
    End Sub

  5. #5
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    I prefer to use case statements:
    Code:
    Private Sub Form_KeyDown1(KeyCode As Integer, Shift As Integer)
    
        Select Case KeyCode
    
            Case vbKeyF1
                KeyCode = 0
                MsgBox "Testing F1 for other than default use."
    
            Case vbKeyF2
    
            Case Else
                MsgBox "Warning! Warning!"
        End Select
    
    End Sub

  6. #6
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919
    GOOD POINT!!! I've added the "Case" of the user hitting another key.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 26
    Last Post: 07-28-2015, 07:52 PM
  2. How to Get Data to Override Higher Amounts
    By ns8069 in forum Database Design
    Replies: 1
    Last Post: 01-28-2015, 02:46 PM
  3. Replies: 5
    Last Post: 09-09-2013, 03:00 PM
  4. Access ignoring format override
    By pdlecesne in forum Reports
    Replies: 4
    Last Post: 04-24-2013, 06:30 PM
  5. Replies: 3
    Last Post: 02-02-2011, 08:04 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums