Hey all,
Got a random problem with the IsDate function and was wondering if anybody could help?
Below is the code I am using to check a user input of a date, and if it is a recognised date put it in to a standard format (dd/mm/yyyy). The problem is that VBA is checking for an American format date -- My input - 15/08/09 (15th Aug 2009)
- Read as 15th August 2009 and displayed as 15/08/2009, which is correct
- But when my input - 07/08/09 (7th Aug 2009)
- Read as 8th July 2009 and displayed as 08/07/2009
This could be very problematic, so is there anyway of telling the IsDate function that the standard format is dd/mm/yyyy not mm/dd/yyyy?
' txtDOD
Set CurrentObject = Options.txtDOD
With CurrentObject
If IsDate(Trim(.Text)) Then
.Text = Format$(.Text, "dd/mm/yyyy")
Add_Entry.SuccessProcedure
Else
Options.lblHelpText = "The Date of Death field must be in any standard date format and cannot be blank."
Add_Entry.ErrorProcedure
MsgBox "You have Entered an incorrect Date. Please correct this error.", vbInformation, "Error"
Exit Sub
End If
End With
Bookmarks