I'm new to VBA code.
I have a button on a form that will save the record and close the form. So far I have this code, it works, but I know it doesn't have any error handling.
Any input greatly appreciated.
Private Sub cmdSave_Click()
Set frm = Forms![frmhoursentry]
If Me.Dirty = True Then
DoCmd.RunCommand acCmdSaveRecord
End If
DoCmd.Close
End Sub
I have a button on a form that will save the record and close the form. So far I have this code, it works, but I know it doesn't have any error handling.
Any input greatly appreciated.
Private Sub cmdSave_Click()
Set frm = Forms![frmhoursentry]
If Me.Dirty = True Then
DoCmd.RunCommand acCmdSaveRecord
End If
DoCmd.Close
End Sub