Validating Birthday on a Textbox
Posted on 2004-08-23
I have a question about validating a birthday which will be inputted in a textbox. It's supposed to look like:
I have this code below, but for some reason it won't accept the same month/day. For example, if I input 10/10/1979 or 05/05/1922. The message box shows up if I go through it:
'Validating Date of Birth so the format should be Year-Month-Day
Private Sub txtDOB_Validate(Cancel As Boolean)
If txtDOB.Text = Format(txtDOB.Text, "dd/MM/yyyy") Then
MsgBox "The Date of Birth (DOB) must be of this format: " + "dd/mm/yyyy.", vbInformation, "Validation"