Results 1 to 3 of 3
  1. #1
    Roncc is offline Advanced Beginner
    Windows 10 Access 2010 32bit
    Join Date
    Dec 2017
    Posts
    91

    On Enter Event code won't run

    Hello all,
    I am working on an inventory audit program and have run into a problem. I have a table named InventoryTbl that contains two fields QuantityInStock and AddItems . The QuantityInStock field contains the number of items (i.e. hairbrushes) currently in stock in the warehouse and the AddItems field is used to record the number of items to be added to the stock when purchased items are received. I have a form, InventoryAddtionFrm, with a table format, that contains both fields and which I use to record the addition of items. i want the QuantityInStock field to automatically update when I add items by placing a number in the AddItems field and have placed the code [QuantityInStock].Value = ([QuantityInStock] + [AddItems] in the On Enter event for the field AddItems but it doesn't work (the value of the QuantityInStock field does not change). I have found that when I place the code in the LostFocus event of the AddItems field the QuantityInStock field does update but I have to strike the Enter Key on my keyboard twice for it to work. Any suggestions on how to fix this problem?

    Thanks for the help.

    Ron Cheshier

  2. #2
    Roncc is offline Advanced Beginner
    Windows 10 Access 2010 32bit
    Join Date
    Dec 2017
    Posts
    91
    I found the answer to my problem. I placed the code in the After Update event for the field AddItems and it works fine. Problem solved.

  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
    Thanks for updating the thread. FYI, the On Enter event happens when first entering the control, not when hitting Enter. It's a common misconception. You found the correct event.
    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. Using Event Code to Disable another Event Code
    By mortonsafari in forum Forms
    Replies: 1
    Last Post: 08-29-2016, 11:09 PM
  2. Replies: 4
    Last Post: 10-18-2014, 10:53 PM
  3. Form Event On Enter
    By JeffGeorge in forum Forms
    Replies: 3
    Last Post: 10-10-2013, 02:14 PM
  4. Field auto enter new line on enter event
    By Ruegen in forum Forms
    Replies: 3
    Last Post: 09-17-2013, 09:00 PM
  5. Replies: 1
    Last Post: 08-15-2011, 03:20 PM

Tags for this Thread

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