I have a button that saves and exits the form. The problem I am having is if I have one of the text boxes empty (required to be full) it will tell me I cannot save. I am trying to add an If statement to the code to not save any of the other data on the form if that box is empty and just exit the form without any errors. Here is the current code. The txt box that is required is named SerialNumber. I keep getting an error 424 object required when I try to exit the form.
Thank you in advance.
Walker
Code:'------------------------------------------------------------ ' btn_Exit_Click.................Saves data and exits form. ' '------------------------------------------------------------ Private Sub btn_Exit_Click() On Error GoTo EH If SerialNumber Is Null Then Me.Undo MsgBox "Data not Saved" DoCmd.Close , "" Else DoCmd.RunCommand acCmdSaveRecord MsgBox "Data Saved" DoCmd.Close , "" End If Exit Sub EH: MsgBox Err.Number & vbCrLf & Err.Description End Sub