Results 1 to 6 of 6
  1. #1
    zy0n1c is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2018
    Location
    AL
    Posts
    21

    How do I increment a record with a button on a form?

    I have a simple inventory system i'm working on. I have a simple "quantity" field. How can I allow my employees to enter a number in a blank text box and hit the "add quantity" or "remove quantity" button when doing inventory receiving? Like...if I even knew what this function was called I might be able to figure it out on my own. How do I add a number input to a single "cell" (record) in my table my form is associated with?



    Click image for larger version. 

Name:	Inventory.png 
Views:	11 
Size:	10.1 KB 
ID:	37812

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Me.Quantity = Me.Quantity + 1
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    zy0n1c is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2018
    Location
    AL
    Posts
    21
    Could you explain in more detail, please? So the button runs a macro that runs that code? Where do I put that code?

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    That is VBA code that would go behind the add button.

    http://www.baldyweb.com/FirstVBA.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    zy0n1c is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2018
    Location
    AL
    Posts
    21
    Wow, that was a lot easier than I thought. I still don't understand WHY it works, but it does work for what I need. Thank you.

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    No problem. The code basically says "set the quantity field equal to whatever it is now plus one".
    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. increment by 1 every button click
    By shod90 in forum Forms
    Replies: 2
    Last Post: 12-17-2016, 10:06 AM
  2. Increment number field on button press.
    By Homegrownandy in forum Access
    Replies: 3
    Last Post: 03-11-2016, 05:54 AM
  3. Replies: 8
    Last Post: 07-06-2013, 05:13 PM
  4. Replies: 23
    Last Post: 04-18-2013, 09:31 PM
  5. Increment a value on button click
    By michaeljohnh in forum Programming
    Replies: 9
    Last Post: 08-25-2010, 10:01 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