Create form button to add 1 to field value

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

What I am trying to do is create a simple button that will +1 to the value of
a field.
Say for instance, record 1 has field "pens" and value 10... i want a simple
button that will change that to 11, then 12 if clicked again.

Thanks in advance
 
Jimbo, this is a question I was going to post also. However I tried a few
things and had limited success with this process. If anyone else has any
better ideas, I would like to know also.

I created a blank button. In the Properties, I clicked on the event tab and
then located the OnClick property. I created an event procedure as follows:

Private Sub Command109_Click()
On Error GoTo Err_Command109_Click

[Feild to update] = [Field to update] + 1

Exit_Command109_Click:
Exit Sub

Err_Command109_Click:
MsgBox Err.Description
Resume Exit_Command109_Click

End Sub


This worked in the couple of tests that I conducted. I also suggest that if
your form is similar in function to mine, that you create another button that
allows you to minus the field value as you need.

Again, if anyone else has any better ways to handle this, I am interested
also.

Jeff
 
Private Sub ButtonToIncrementPensField_Click()
Me.Pens = Me.Pens + 1
End Sub

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000

Message posted via AccessMonster.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top