D
dsc2bjn
I created an input form and added validation code as the form is close;
however, the error message do not keep the form from closing.
What do I need to do?
Private Sub save_Click()
On Error GoTo Err_save_Click
If (Eval("[Forms]![frmOther Weakness Corrective Actions (Edit/Update
Entry)]![Tracking Number] Is Null")) Then
MsgBox "A Value for 'Tracking Number' is Required.", vbOKOnly, "Required
Value Missing"
End If
If (Eval("[Forms]![frmOther Weakness Corrective Actions (Edit/Update
Entry)]![Deficiency Source] Is Null")) Then
MsgBox "A Value for 'Deficiency Source' is Required.", vbOKOnly,
"Required Value Missing"
End If
If (Eval("[Forms]![frmOther Weakness Corrective Actions (Edit/Update
Entry)]![Deficiency Description] Is Null")) Then
MsgBox "A Value for 'Deficiency Description' is Required.", vbOKOnly,
"Required Value Missing"
End If
If (Eval("[Forms]![frmOther Weakness Corrective Actions (Edit/Update
Entry)]![Deficiency Description] Is Not Null and [Forms]![frmOther Weakness
Corrective Actions (Edit/Update Entry)]![Validation Indicator] Is Null")) Then
MsgBox "A Value for 'Validation Indicator/Exit Criteria' is Required.",
vbOKOnly, "Required Value Missing"
Else
DoCmd.Close
End If
Exit_save_Click:
Exit Sub
Err_save_Click:
MsgBox Err.Description
Resume Exit_save_Click
End Sub
however, the error message do not keep the form from closing.
What do I need to do?
Private Sub save_Click()
On Error GoTo Err_save_Click
If (Eval("[Forms]![frmOther Weakness Corrective Actions (Edit/Update
Entry)]![Tracking Number] Is Null")) Then
MsgBox "A Value for 'Tracking Number' is Required.", vbOKOnly, "Required
Value Missing"
End If
If (Eval("[Forms]![frmOther Weakness Corrective Actions (Edit/Update
Entry)]![Deficiency Source] Is Null")) Then
MsgBox "A Value for 'Deficiency Source' is Required.", vbOKOnly,
"Required Value Missing"
End If
If (Eval("[Forms]![frmOther Weakness Corrective Actions (Edit/Update
Entry)]![Deficiency Description] Is Null")) Then
MsgBox "A Value for 'Deficiency Description' is Required.", vbOKOnly,
"Required Value Missing"
End If
If (Eval("[Forms]![frmOther Weakness Corrective Actions (Edit/Update
Entry)]![Deficiency Description] Is Not Null and [Forms]![frmOther Weakness
Corrective Actions (Edit/Update Entry)]![Validation Indicator] Is Null")) Then
MsgBox "A Value for 'Validation Indicator/Exit Criteria' is Required.",
vbOKOnly, "Required Value Missing"
Else
DoCmd.Close
End If
Exit_save_Click:
Exit Sub
Err_save_Click:
MsgBox Err.Description
Resume Exit_save_Click
End Sub