Results 1 to 8 of 8

IsDate function looking for American Date

Threaded View

  1. #1
    Forum Contributor
    Join Date
    09-03-2008
    Location
    Somerset, England
    MS-Off Ver
    XP, 2003, 2007 - depends on location
    Posts
    185

    IsDate function looking for American Date

    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
    Last edited by duckboy1981; 07-21-2009 at 05:05 AM.
    Ducks are better crispy...

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1