Date validation

  • Thread starter Thread starter yami-s
  • Start date Start date
Y

yami-s

In a form I use thare is a text box that the user should enter a date,
how can I validate the entry, and pop up a msgbox if the entry is
wrong
10x
yami
 
Yami,

Here is one suggestion

Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Dim myDate As Date
On Error GoTo no_date
myDate = CDate(TextBox1.Text)
Exit Sub
no_date:
MsgBox "Invalid date"
End Sub

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Great!

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Back
Top