C
CES
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
All,
How do you undo a required date field based on a message box response. The error message that I am receiving is:
"The value in the field or record violates the validation rule for the record or field..."
Private Sub DateOfInvoice_BeforeUpdate(Cancel As Integer)
Dim objMsgBox As Integer
objMsgBox = MsgBox("Add an Invoice for: " & vbCrLf & "Year - " & DatePart("YYYY", Me.DateOfInvoice.Value, vbLongDate) & " ?", vbYesNo, "Continue")
If objMsgBox = vbYes Then
MsgBox ("Do something")
Else
Me.DateOfInvoice.Undo
Cancel = True
'Ideally I would like the field to go back to an empty state as opposed to the value just being highlighted.
'Me.DateOfInvoice.SetFocus
'Me.DateOfInvoice.Value = null or ""
End If
End Sub
Any thoughts would be greatly appreciated. Thanks in advance.- CES
Content-Transfer-Encoding: 7bit
All,
How do you undo a required date field based on a message box response. The error message that I am receiving is:
"The value in the field or record violates the validation rule for the record or field..."
Private Sub DateOfInvoice_BeforeUpdate(Cancel As Integer)
Dim objMsgBox As Integer
objMsgBox = MsgBox("Add an Invoice for: " & vbCrLf & "Year - " & DatePart("YYYY", Me.DateOfInvoice.Value, vbLongDate) & " ?", vbYesNo, "Continue")
If objMsgBox = vbYes Then
MsgBox ("Do something")
Else
Me.DateOfInvoice.Undo
Cancel = True
'Ideally I would like the field to go back to an empty state as opposed to the value just being highlighted.
'Me.DateOfInvoice.SetFocus
'Me.DateOfInvoice.Value = null or ""
End If
End Sub
Any thoughts would be greatly appreciated. Thanks in advance.- CES