How to give Date format while entering date
hi!
I m trying to use a format dd/mm/yyyy for entering date in textbox. If user enters format other than dd/mm/yyyy, as soon as the textbox losts its focus it gives a msg to user to enter date in correct format. I tried using following code but even if i give correct format it gives same msg as if it is not incorrect format.
Could anyone be able to correct it plz..
Private Sub txtDob_LostFocus()
If txtDob.Text <> "dd'/ 'MM' / 'yyyy" Then
MsgBox "Please! Mention the date of birth in dd/mm/yyyy format", vbInformation
txtDob.SetFocus
SendKeys "{Home}+{End}"
End If
End Sub
|