Results 1 to 7 of 7
  1. #1
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Date (Access A2002 and A97)

    I have a data field in a table that has a format of Medium Date. When I enter in an invalid date (31 nov 03) it ends up with 03/11/31.
    I cannot fathom what is going on here. I have tried to use the IsDate function in the BeforeUpdate event of the control but to no avail.
    Any ideas?

  2. #2
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Date (Access A2002 and A97)

    That's actually a date that is being interpreted as March 11, 2031 I think. I don't think you can do it in 97, but in 2002 you can force dates to always be displayed with a 4-digit year, so try that and see if that tells you what you are really getting. I suspect this is getting tangled up with the US date format somehow, as the internal default is always mm/dd/yyyy.
    Wendell

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Date (Access A2002 and A97)

    Access is being overly user-friendly here. It assumes that you made a mistake (which is correct) and that, since there is no 31 November, 31 must be the year and 03 the day (which you didn't intend). There is not much you can do against it, I think, unless you let the user enter the date as text, and do the validation yourself before storing it in a date field.

  4. #4
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Date (Access A2002 and A97)

    Thanks Wendell, it display the year as 1931 however.

  5. #5
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Date (Access A2002 and A97)

    Thanks Hans
    If you are right and I suspect you are, that is not good. Especially if users don't look at what they are entering, they then end up with a crook date.
    What I may have to do is to check the year for 1 year either side of the current year.
    This is a terrible workaround, I would much prefer it shows an invalid date message rather than trying to be smart and ending up with a bum date.

  6. #6
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Date (Access A2002 and A97)

    Yes, you are right - the current boundary on two digit years is 2030. Anything over 30 is presumed to be 1931. Moral - never use two-digit years.
    Wendell

  7. #7
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Date (Access A2002 and A97)

    Thanks Wendell, but there's always a kicker (moral) isn't there? <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

Posting Permissions

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