Thread: Date Validation
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Date Validation

IsDate(Textbox1.Text)

or:

Private Sub CommandButton1_Click()
Dim DtVal As Date
DtVal = 0
On Error Resume Next
DtVal = CDate(TextBox1.Text)
On Error GoTo 0
If Not DtVal = 0 Then
Label1.Caption = "Good Date"
Else
Label1.Caption = "Bad DAte"
End If
End Sub

as an example.

Look at the Calendar Control

mscal.ocx I believe. It might be available in the VBE under tools=
Additional controls (available when you userform has the focus)

--
Regards,
Tom Ogilvy




"Nigel" wrote in message
...
1. I have a number of userform textbox controls that are designated as

dates
(European Format dd/mm/yy). What is the best method of validating date
entry?

2. Related to 1 above, are there any active-x controls that I can use to
display a calendar that pops up when the user enters the textbox that
requires a date to be entered?

TIA

Nigel






----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet

News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! 100,000

Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption

=---