Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

increment vale in entire column of a table with click of a button 2

Status
Not open for further replies.
Jan 27, 2003
35
0
0
GB
I want to be able to increment all the values in the entire column in a table, on the click of a button, any ideas?

 
1) create a button
2) create an update query that updates the field to itself + 1 (e.g. Field: FieldName, UpdateTo:[FieldName] + 1
3) add an OnClick event procedure to the button
4) add Docmd.OpenQuery "QueryName" to the event procedure for the button
 
Private Sub Button_Click()

Currentdb.Execute "UPDATE MyTable SET MyField = MyField + Increment"

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top