Hello.
I have a Form which is used by a security team to create reports on incidents encountered on their shift and email out to department heads.
I have a command box which is coded to send the report as email when pressed, and save and close the record.
I have code to ensure data goes into all the fields.
My problem is, as I am using a command box for the Submit button, and there is no "Before Update" event on the command box, I'm not sure how to make it check all the fields for data BEFORE allowing the email dialogue to pop up.
Existing Code follows:
Code:
Private Sub Submit_GotFocus()
Dim cCont As Control
For Each cCont In Me.Controls
If TypeName(cCont) = "TextBox" Then
If IsNull(cCont) Then
MsgBox "Please provide a description for " & cCont.Name & " field(s)!"
Exit Sub
End If
End If
Next cCont
For Each cCont In Me.Controls
If TypeName(cCont) = "ComboBox" Then
If IsNull(cCont) Then
MsgBox "Please provide a description for " & cCont.Name & " field(s)!"
Exit Sub
End If
End If
Next cCont
End Sub
I'm using GotFocus which obviously won't handle it the way I want to, but that's easy enough to change once I know how to do what I want to do. Help please =)