i have 2 combo boxes on a form and a button to add a new record in a table. i am trying to add code so that if either of the boxes is 'null' that an error message displays and the code ends so that a partial record isnt entered into the table. i think the solution is adding a line somewhere to my code but im not sure where. Here is the code i have for just one of the boxes to get it working correctly:
This code gives me the error message, ive tried putting in end sub/exit sub before and after the 'end if' but each time the record is added to the table.
Can someone tell me how to end the procedure after the if statement if its condition is true?
Code:
Private Sub Command31_Click()
On Error GoTo Err_Command31_Click
If IsNull(Me.Combo14) Then
MsgBox ("invalid selection made")
End If
DoCmd.GoToRecord , , acNewRec
Exit_Command31_Click:
Exit Sub
Err_Command31_Click:
MsgBox Err.Description
Resume Exit_Command31_Click
End Sub
This code gives me the error message, ive tried putting in end sub/exit sub before and after the 'end if' but each time the record is added to the table.
Can someone tell me how to end the procedure after the if statement if its condition is true?