The following will help. You can apply this to the On-click of a save or exit button, or the close event of the form. For this example I have this code attached to a Save Button on my form and this is the Event Procedure for the On-Click. My button's name is also called Save.
Private Sub Save_Click()
On Error GoTo Err_Save_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Exit_Save_Click:
Exit Sub
Err_Save_Click:
MsgBox Err.Description
Resume Exit_Save_Click
End Sub
Good Luck