Results 1 to 4 of 4
  1. #1
    JB510's Avatar
    JB510 is offline Advanced Beginner
    Windows 11 Office 365
    Join Date
    Jan 2023
    Location
    Ontario
    Posts
    44

    VBA code to capture keypress

    I am running a code which takes a long time to process.
    I sometimes want to [Ctrl][Break] to temporarily halt and check the code then continue but it gets so busy, the [Ctrl][Break] does not respond.

    Back in by C64 basic days, there used to be a GET statement were the code would not stop like an Inputbox, it would just capture the a keypress if the key is pressed down.
    Is there such a command in VBA for MS Access?
    I could use this to trigger a temporary halt in my code.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    i dont think access will give up the time to get the keypress.

  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,652
    Won't including DoEvents in the code let Access check for the keypress?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    KNicholson is offline Novice
    Windows 10 Office 365
    Join Date
    Mar 2023
    Posts
    6
    Once a long running query is churning, I sometimes use TaskManager to stop it.
    I know it is not best practice but my data is in SQL Server and my databases are always backed up.
    If a query takes too long to process, the processing needs to be moved to SQL Server.
    I mess up sometimes when developing a run a query without a filter and get hosed.

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

Similar Threads

  1. keypress question
    By sdel_nevo in forum Modules
    Replies: 11
    Last Post: 06-05-2018, 10:32 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. Replies: 3
    Last Post: 10-15-2013, 10:54 AM
  5. Replies: 1
    Last Post: 03-31-2011, 02:51 AM

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