Results 1 to 4 of 4
  1. #1
    DC CS is offline Advanced Beginner
    Windows 11 Office 365
    Join Date
    Jan 2023
    Location
    Vaalpark, South Africa
    Posts
    70

    Saving dates in MS Access

    Hi all,
    Using MS Access 365 and have an issue with saving dates.
    I am in South Africa, so I need to save the date as "dd-mm-yyyy".
    I have tried saving with these formats, but to no avail:

    Format(StartDate, "dd-mm-yyyy")
    Format(StartDate, "#\dd-mm-yyyy\#")
    Format(StartDate, "dd-mm-yyyy")

    If I save the date 01-03-2022 and check the table, the date has been saved as 10-11-1894, or 23-11-1894. I save these dates without changing them, and they are saved different than the original.

    I did not have the issue before. It started about a week ago. Not sure if anything has changed with Microsoft??



    Any advise?

    Thanks
    Deon

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Nothing has changed with MS Access that I am aware of.

    Dates are actually saved as a double number in a date/time field. The dd-mm-yyyy or mm/dd/yyyy is a display format. Access translates the double number to default display as mm/dd/yyyy. This can be adjusted with regional settings.

    Review http://allenbrowne.com/ser-36.html
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    Dates are stored as decimal numbers in Access the integer portion represents date, the fractional part represents the time.
    So by using a format() you are converting a date to a string.

    Check your regional settings.
    Your Display format is a different thing and will be determined by your regional settings.

    Can you display the code used to save the dates?
    In VBA code you have to force the date to a specific (American) format mm/dd/yyyy or much more preferably use yyyy-mm-dd , then you are in no doubt what date you are saving when you do a debug.

    Format([MyDate],"#\yyyy-mm-dd\#" )

    More assistance here: http://allenbrowne.com/ser-36.html
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  4. #4
    DC CS is offline Advanced Beginner
    Windows 11 Office 365
    Join Date
    Jan 2023
    Location
    Vaalpark, South Africa
    Posts
    70
    Thanks guys. I changed the save format to American and the display (regional settings) to dd-mm-yyyy.
    All is back to normal.

    Thanks for the assistance.
    Regards
    Deon

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Saving Dates in a Table
    By bo16tx in forum Access
    Replies: 19
    Last Post: 12-29-2017, 09:27 PM
  2. Replies: 2
    Last Post: 09-19-2017, 11:31 AM
  3. Replies: 3
    Last Post: 04-22-2015, 04:35 AM
  4. Replies: 8
    Last Post: 12-02-2013, 03:46 PM
  5. Saving Access 2010 database to Access 2007
    By Bajaz001 in forum Access
    Replies: 2
    Last Post: 04-11-2011, 12:59 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums