I have an Access form with a Subform when the User clicks Save on the Main form I need to check and make sure a required field has been populated on the subform. Below is the code I am using it runs but doesn't work (ignores test). Basically if a User selects "Pending" in the cmb_ActionCode I want to require them to select a description from cmb_PendingDesc.
Any help is greatly appreciated... thanks
Code:
Forms![Frm_Main]![Tbl_Worklist_subform].SetFocus
If Not Forms![Frm_Main]![Tbl_Worklist_subform].Form.Recordset.EOF Then
Forms![Frm_Main]![Tbl_Worklist_subform].Form.Recordset.MoveFirst
For tmpint = 0 To Forms![Frm_Main]![Tbl_Worklist_subform].Form.Recordset.RecordCount - 1
If (Forms!Frm_Main!Tbl_Worklist_subform![cmb_ActionCode] = "Pending" And IsNull(Forms!Frm_Main!Tbl_Worklist_subform![cmb_PendingDesc]) = True) Then
MsgBox "When the Pending Action Code is selected you must select a Pending Description, Record Not Saved"
Exit Sub
End If
Next tmpint
End If
Any help is greatly appreciated... thanks