Alhakeem1977
Registered User.
- Local time
- Tomorrow, 01:57
- Joined
- Jun 24, 2017
- Messages
- 308
Hi all,
How can I loop through current records to find if the subform contains a null value in the data entry form then return an error message?
Please find below my code which works fine if I navigate to a record not contains a null value but for other records will not catch it while closing the form.
Appreciate your kind help. Thanks in advance!
How can I loop through current records to find if the subform contains a null value in the data entry form then return an error message?
Please find below my code which works fine if I navigate to a record not contains a null value but for other records will not catch it while closing the form.
Code:
Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
If Status = 2 Or Status = 3 And Status <> 10 And IsNull([ImagesSubform].Form![Path]) Then
Beep
MsgBox "You must scan & attach the payment request first!", vbExclamation, "No Attachment"
Cancel = True
End If
If Status = 1 And Status <> 10 And IsNull([ImagesSubform].Form![Path]) Then
Beep
If MsgBox("Are you sure you want to exit without dispatching the Payment(s) details?" & vbCrLf & _
"As the status must be changed to (Submitted)", vbYesNo, "Exit Confirm") = vbNo Then
Cancel = True
Me.Status.SetFocus
End If
End If
End Sub
Appreciate your kind help. Thanks in advance!