Livin404
Well-known Member
- Joined
- Jan 7, 2019
- Messages
- 743
- Office Version
- 365
- 2019
- Platform
- Windows
Greetings,
I'm quite happy I was able to sort out a code to ensure my date box is not left blank. What I would like is to make sure the box is not blank or the user doesn't type any rubbish in to get past the requirement. I would love to have this be an or type statement it can't be blank and it has to read in a "dd mmm yy" format.
The existing code is:
Thank you very much indeed.
I'm quite happy I was able to sort out a code to ensure my date box is not left blank. What I would like is to make sure the box is not blank or the user doesn't type any rubbish in to get past the requirement. I would love to have this be an or type statement it can't be blank and it has to read in a "dd mmm yy" format.
The existing code is:
VBA Code:
Private Sub TxtDate_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If Trim(TxtDate.Value) = "" And Me.Visible Then
MsgBox "Please enter date in dd mmm yy format", vbCritical, "Error"
Cancel = True
InboundForm.TxtDate.SetFocus
TxtDate.BackColor = vbYellow
Else
TxtDate.BackColor = vbWhite
End If
End Sub
Thank you very much indeed.