In this example, the 'tool code' is a long integer and also the primary key.

Function NextToolID(Customer)
    ' add the next sequential tool number
    Dim db As Database, rst As Recordset, tmp As Long
    Set db = CurrentDb
    Set rst = db.OpenRecordset("tblToolLog")
    rst.MoveLast
    tmp = 1 + rst!fldToolCodeID
    rst.AddNew
    rst!fldToolCodeID = tmp
    rst!fldCustomerID = Customer
    rst.Update
    rst.Close
    Set rst = Nothing
    Set db = Nothing
    NextToolID = tmp
End Function