Results 1 to 3 of 3
  1. #1
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    1,919

    New Popup form won't fire KeyPress Event

    Building a simple popup form. One label control and 3 command button controls are the only controls on the form. One Form Event, OnKeyPress but it doesn't fire when Escape key pressed. (Also tested KeyUP and KeyDown events and they do not fire either)



    Any ideas? (An OnOpen event fires okay but an OnClick DOES NOT fire)

    Click image for larger version. 

Name:	000.jpg 
Views:	5 
Size:	106.8 KB 
ID:	37443Click image for larger version. 

Name:	001.jpg 
Views:	5 
Size:	34.1 KB 
ID:	37444

    Code:
    Option Compare Database
    Option Explicit
    
    
    Private Sub Form_KeyPress(KeyAscii As Integer)
    MsgBox "KeyPress Firing?"
    If KeyAscii = vbKeyEscape Then DoCmd.Close
    End Sub

  2. #2
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    1,919
    RATS! I thought I'd checked the "Key Preview" property but it wasn't set properly.

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Thanks for the update. Hunker down up there!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. How to cause a form event to fire from a general module
    By GraeagleBill in forum Programming
    Replies: 10
    Last Post: 09-04-2016, 08:08 AM
  2. When press tab, ignore keypress event
    By jlgray0127 in forum Forms
    Replies: 4
    Last Post: 08-16-2016, 10:24 AM
  3. KeyPress event please help
    By braveheart_bh in forum Forms
    Replies: 1
    Last Post: 08-25-2015, 12:00 AM
  4. Fire off event on another form
    By Ruegen in forum Access
    Replies: 4
    Last Post: 04-12-2015, 11:50 PM
  5. A KeyPress Event and UNICODE character set
    By Marin in forum Programming
    Replies: 0
    Last Post: 02-27-2013, 08:32 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