Click to See Complete Forum and Search --> : Date Validation


January 20th, 2000, 03:56 AM
Hi ,
How do i check to see if the date entered in the textbox is in the correct format that i want it ot be.
Eg: If i want the date to be in dd/mm/yyyy format then what do i have to do to check that this is the format that is correct.
Can i write this in my code:--

If IsDate(txtStartDT.Text) Then
If txtStartDT.Text = mm / dd / yy Or txtStartDT.Text = yy / mm / dd Then
MsgBox "Please enter dd/mm/yyyy format for STARTDATE only."
txtStartDT.SetFocus

Exit Sub

End If

End If

I am working on a visual basic project and would like to know how to do this. i have an access database.
This is not html vbscript!

Also how do i stop someone from updating a certain textbox.
Like if i dont want a user to update the textbox having the employee's name. What will be the form validation!!!!!
Thanks for any answers,
New to Visual Basic ............;)

Lothar Haensler
January 20th, 2000, 06:13 AM
>Also how do i stop someone from updating a certain textbox.

set the Locked property to True to protect the field from data entry.

Your date format problem:
when outputting date values I'd use the Format statement.
When interpreting date values assume that date values are in the format given in control panel - language settings.