Create form button to add 1 to field value

J

JimboJones

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
 
J

Jeff @ CI

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
 
M

missinglinq via AccessMonster.com

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