• Buttons to bump a number up and/or down (2000)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Buttons to bump a number up and/or down (2000)

    Author
    Topic
    #368084

    Is there a tool to add and/or subtract 1 to a number field while a command button is depressed? I have a field for Miles (of a vehicle as reported at trade) which must be updated when the vehicle is later offered for sale. Since having to re-enter up to 6 characters, there is a high probability of input error. I have included a check that alerts if the miles are lower than previously reported, but would prefer to just have a command button to add what is often less than 10 additional miles.

    Any input would be appreciated.
    Kathi Mills

    Viewing 0 reply threads
    Author
    Replies
    • #575868

      Dim i As Long
      i = MileageTextboxName
      i = i + 1
      MileageTextboxName = i
      Put this is the click event for your button.
      Paul

      • #575871

        Paul,
        Thanks for responding. Your solution was one that I had considered, however I don’t think it works without clicking 10 times to add 10 miles. What I’m looking for is something that lets the “add 1” loop for as long as the button is depressed. I’m thinking maybe a combination of KeyPress, KeyDown, or KeyUp is possible but I’ve never even noticed them before. I’ve seen the type of thing I’m trying to accomplish in so many non-Access applications. I’ll keep plugging away — with the utmost confidence, of course clever
        Kathi

        • #575885

          I’m relieved to report that my confidence was not ill-placed. Put the code (me.miles = me.miles + 1) in the OnClick property, changed the AutoRepeat property to “Yes” and added a DoCmd.Repaint. Now it is EXACTLY what I wanted.
          Thanks!
          Kathi

    Viewing 0 reply threads
    Reply To: Buttons to bump a number up and/or down (2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: