G
Guest
I am validating a line, and have various code to check required fields (we
don't block user from leaving), and in one particular field, the BA Signoff
(meaning the line is complete), I need to blank out the date if one exists.
I
f they are entering a date, and the line is incomplete (I have this piece),
then I need to blank out the date. I have tried various combinations of the
code below.
How do I assign a 'blank' value to a date field, clear it?
My code:
Private Sub BA_Signoff_BeforeUpdate(Cancel As Integer)
Dim ctl As Control
Dim strEmpty As String
Dim strMsg As String
Dim blankDate As Variant
blankDate = Null
For Each ctl In Me.Controls
If ctl.Tag = "check" Then
If IsNull(ctl) Then
strEmpty = strEmpty & vbCrLf & ctl.Name
End If
End If
Next ctl
If strEmpty <> "" Then
strMsg = "These fields are missing a value: " & vbCrLf & vbCrLf & _
Mid(strEmpty, 3) & vbCrLf & vbCrLf _
& "All required fields must be filled before BA Line Item
Signoff." & vbCrLf & vbCrLf _
& "Please complete line and signoff again."
MsgBox strMsg, vbCritical + vbOKOnly, "Issue Line Incomplete!"
Me.IssueStatus = "I" 'Incomplete
Cancel = True
Me.BA_Signoff.Text = blankDate
End If
End Sub
don't block user from leaving), and in one particular field, the BA Signoff
(meaning the line is complete), I need to blank out the date if one exists.
I
f they are entering a date, and the line is incomplete (I have this piece),
then I need to blank out the date. I have tried various combinations of the
code below.
How do I assign a 'blank' value to a date field, clear it?
My code:
Private Sub BA_Signoff_BeforeUpdate(Cancel As Integer)
Dim ctl As Control
Dim strEmpty As String
Dim strMsg As String
Dim blankDate As Variant
blankDate = Null
For Each ctl In Me.Controls
If ctl.Tag = "check" Then
If IsNull(ctl) Then
strEmpty = strEmpty & vbCrLf & ctl.Name
End If
End If
Next ctl
If strEmpty <> "" Then
strMsg = "These fields are missing a value: " & vbCrLf & vbCrLf & _
Mid(strEmpty, 3) & vbCrLf & vbCrLf _
& "All required fields must be filled before BA Line Item
Signoff." & vbCrLf & vbCrLf _
& "Please complete line and signoff again."
MsgBox strMsg, vbCritical + vbOKOnly, "Issue Line Incomplete!"
Me.IssueStatus = "I" 'Incomplete
Cancel = True
Me.BA_Signoff.Text = blankDate
End If
End Sub