Public Function FieldValidate()
'Place an asterisk (*) in the Tag Property of the text boxes you wish to validate.
'Then in the BeforeUpdate Event of the form, copy/paste the following:
'modified to add Label text to message box instead of field name
'ctl.Controls(0).Caption instead of ctl.Name
'This will make much more sense to a user
Dim msg As String, Style As Integer, Title As String
Dim nl As String, ctl As Control, Source As String, Cancel As Integer, Answer As Variant
nl = vbNewLine & vbNewLine
For Each ctl In Me.Controls
If ctl.ControlType = acTextBox Or ctl.ControlType = acOptionGroup Or ctl.ControlType = acComboBox Then
If ctl.Tag = "*" And Trim(ctl & "") = "" Then
msg = "Data Required for '" & ctl.Controls(0).Caption & "' field" & nl & _
"You can't save this record until this data is provided" & nl & _
"Enter the data and try again . . . "
Style = vbCritical + vbOKOnly
Title = "Required Data..."
MsgBox msg, Style, Title
ctl.SetFocus
Answer = "False"
Me.txtValid = Answer
Cancel = True
Exit For
Else: Answer = "True"
Me.txtValid = Answer
End If
End If
Next
Set ctl = Nothing
Call AuditTrail(Me, InterviewID)
End Function