View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Date Format on Form

Dim dt as Date
On Error Resume Next
dt = cdate(Userform1.Textbox1.Text)
On Error goto 0
if dt < 0 then
' other validation checks if it can't be any date

--
Regards,
Tom Ogilvy



"Brad" wrote in message
...
Thanks for taking the time to read my question.

I have a field on a form in which I want the user to enter a valid date.
How do I check to make sure it is a valid date? Do I have to get the

system
settings, then compare the entered value to the system settings? If so

how
do I do that?

For example, under Control Pannel | Regional and Language Options |
Customize | Date : Short Date format

Compare this to the value entered on the form.

Are there easier ways?

Thanks,

Brad