Results 1 to 5 of 5
  1. #1
    10 Gauge's Avatar
    10 Gauge is offline Getting the hang of it...
    Windows 7 64bit Access 2007
    Join Date
    Feb 2011
    Location
    Fredericksburg, VA
    Posts
    202

    +1 on button click

    I need to add code to a button I already have that will also add 1 to an integer field on a form so that each time the button is pressed the field displays how many times it has been pressed.



    I have tried: Me.[PrevTicketCount] = +1

    but it deletes the + when I cursor away from it and when I try it, it just writes 1 to the field no matter how many times the button is pressed.

    TIA.

  2. #2
    jzwp11 is offline VIP
    Windows 7 Access 2007
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    If I understand correctly, you need this:

    Me.[PrevTicketCount] = Me.[PrevTicketCount] +1

  3. #3
    10 Gauge's Avatar
    10 Gauge is offline Getting the hang of it...
    Windows 7 64bit Access 2007
    Join Date
    Feb 2011
    Location
    Fredericksburg, VA
    Posts
    202
    Yes something like that however it didn't work. The code doesn't kick back any errors but it's not adding anything to the PrevTicketCount field when I click my button.

    It works if I start the field with a 1, but if the field is blank it will not work....

    Edit: Problem sorted, because I added the field after the fact, there was no default 0 value for records already in the db, so after manually updating the records with a number all seems to be working and new entries are automatically assigned a value of 0.

    Thanks!

  4. #4
    jzwp11 is offline VIP
    Windows 7 Access 2007
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    Glad to hear that you sorted it out! Good luck with your project.

  5. #5
    10 Gauge's Avatar
    10 Gauge is offline Getting the hang of it...
    Windows 7 64bit Access 2007
    Join Date
    Feb 2011
    Location
    Fredericksburg, VA
    Posts
    202
    Thank you sir! This forum has been a huge help so far.

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

Similar Threads

  1. Command button click event
    By R_jang in forum Programming
    Replies: 10
    Last Post: 10-29-2010, 10:13 PM
  2. Increment a value on button click
    By michaeljohnh in forum Programming
    Replies: 9
    Last Post: 08-25-2010, 10:01 AM
  3. On Click Event For Button On Form
    By Desstro in forum Forms
    Replies: 3
    Last Post: 08-09-2010, 02:36 PM
  4. Replies: 1
    Last Post: 03-03-2010, 07:29 PM
  5. VB coding for saving when click on save button in form
    By cwwaicw311 in forum Programming
    Replies: 1
    Last Post: 02-04-2010, 11:11 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