Hey guys,I have a field on a form called tracking that is a bound text box. When the user goes to add a record to the form, I want this text box to automatically populate with the next tracking sequential tracking number in the table.
I have an old Access 2003 database that accomplished this task, but I can't figure out how they did it. They have a text box called text20 for the tracking number, and an unbound text box called text58. I clicked view code, and found this:
Private Sub Command60_Click()
Recordset.MoveLast
Text58 = Text20
Recordset.AddNew
Text20 = Text58 + 1
End Sub
Private Sub Command61_Click()
Recordset.MovePrevious
Recordset.MoveNext
Recordset.MoveNext
End Sub
It looks like this code is doing the auto-increment, but I don't know how to implement it into my form. How does Access know what the previous tracking number was in the table?
I have an old Access 2003 database that accomplished this task, but I can't figure out how they did it. They have a text box called text20 for the tracking number, and an unbound text box called text58. I clicked view code, and found this:
Private Sub Command60_Click()
Recordset.MoveLast
Text58 = Text20
Recordset.AddNew
Text20 = Text58 + 1
End Sub
Private Sub Command61_Click()
Recordset.MovePrevious
Recordset.MoveNext
Recordset.MoveNext
End Sub
It looks like this code is doing the auto-increment, but I don't know how to implement it into my form. How does Access know what the previous tracking number was in the table?