'Update Table from a Form using cmd button

Okay i would like to be able to update part attributes table from a form. The Part_ID in table (primary key) is listed in combo box in form (prtnum_cbo) this carries a list of attributes that can be loaded into form, from the table SawPartNumber. I found code that works to Add a new record to table below. But I can not find anything on how to update or edit the record in table linked to Part_ID / prtnum_cbo. Using same logic as add new i can edit.. but only the 1st record in table updates

Private Sub svprt_cmd_Click()
    On Error GoTo Error_Handler
    
        Dim db As Database
        Dim rec As Recordset

        Set db = CurrentDb
        Set rec = db.OpenRecordset("Select * from SawPartNumber")

        rec.AddNew
        rec("Part_ID") = Me.prtnum_cbo
        rec("Rev") = Me.rev_txt
        rec("Tool Type") = Me.tool_cbo
        rec("Tool Diameter") = Me.TDia_txt
        rec("Wing count") = Me.tip_cnt_txt
        rec("Saw Style") = Me.styl_cbo
        rec("Kerf") = Me.kerf_txt
        rec("Tip style") = Me.tips_cbo
        rec("Tip grade") = Me.tipg_txt
        rec("Hook") = Me.hook_txt
        rec("OD cl") = Me.odcl_txt
        rec("Radial") = Me.radin_txt
        rec("Back") = Me.backin_txt
        rec("Drop") = Me.drop_txt
        rec("Top Bvl") = Me.tpbvl_txt
        rec("Cnr Brk") = Me.cnrbk_txt
        rec("K Lnd") = Me.klnd_txt
        rec("Tooth Style Count") = Me.tscnt_txt
        rec("Special Notes") = Me.prtnts_txt
        rec("Tooth style") = Me.toos_txt
   
        rec.Update

        Set rec = Nothing
        Set db = Nothing
Error_Handler_Exit:
    On Error Resume Next
    Exit Sub
 
Error_Handler:
    MsgBox "Part already exists"

    Resume Error_Handler_Exit

End Sub


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source