Results 1 to 4 of 4
  1. #1
    Poohbear0471 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Posts
    78

    Increment field value

    I'm building a little db for a friend to keep track of her yarn and knitting projects. One thing she asked for was a row counter. I have my field ProjectRowCount. It's number format, default value is 1. I need to add two buttons. One will increase the field value by 1 and the other will decrease it by 1. I've searched google and the forums here and everything comes back with increasing a field value based on a prior record. I need to increment the current field value in the current record. I currently have the increase button with an OnClick event as =[ProjectRowCount]+1, but that doesn't do anything.

    Side note... I did find the SpinButton activex control, but it seems like I have to refresh the page after every click.

    Suggestions?

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    you need to use vba - click the 3 dot carat on the right and select event procedure

    Code:
    Private Sub btnIncrease_Click()
    
    me.ProjectRowCount =me.ProjectRowCount+1
    
    End sub

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,820
    That won't do anything. Need to call a macro or VBA.

    For VBA, select [Event Procedure] in Click event property and code would have something like:

    Me.textboxname = Me.textboxname + 1

    Review http://www.baldyweb.com/FirstVBA.htm


    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #4
    Poohbear0471 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Posts
    78
    Thanks folks! Got it!

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

Similar Threads

  1. Replies: 3
    Last Post: 08-19-2019, 05:58 PM
  2. Replies: 7
    Last Post: 10-29-2015, 04:20 PM
  3. Replies: 15
    Last Post: 05-17-2012, 01:12 PM
  4. Increment Field Value
    By Malseun in forum Access
    Replies: 9
    Last Post: 02-03-2012, 04:55 AM
  5. Replies: 5
    Last Post: 11-12-2010, 12:10 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