Results 1 to 7 of 7
  1. #1
    New Lounger
    Join Date
    Feb 2001
    Location
    Yell, Shetland, Scotland
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Convert UK General date format (gdf) to US gdf (Access 2000 sr.1)

    I need to have a quick and easy way to convert the general date format, just for one particular database.

    Currently it is:

    dd/mm/yy hh:nn:ss

    I need:

    mmm dd yyyy hh:nn:ss
    Is it feasible to do this as a macro, or is best with a short module?

    If so how?

  2. #2
    Star Lounger
    Join Date
    Dec 2001
    Location
    Fredensborg, Denmark
    Posts
    86
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Convert UK General date format (gdf) to US gdf (Access 2000 sr.1)

    In tables, forms and reports use the format property to specify your date format (e.g. mmm dd yyyy).
    In code use Format(yourdateandtime,"mmm dd yyyy hh:nn:ss").

    For information about international settings use Access help. Type this in the Office assistant: international dateformats

  3. #3
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Convert UK General date format (gdf) to US gdf (Access 2000 sr.1)

    I don't think you can do exactly what you want. By changing your Windows regional settings, you can change the "short date" and "Long date" settings, but I don't think you can change the "general date". If it detects US, it will display it as m/d/yy hh:nn:ss.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  4. #4
    New Lounger
    Join Date
    Feb 2001
    Location
    Yell, Shetland, Scotland
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Convert UK General date format (gdf) to US gdf (Access 2000 sr.1)

    I wondered if it could be done by setting up a new Input mask using the Input Mask Wizard, with the specific date format needed?

  5. #5
    Star Lounger
    Join Date
    Dec 2001
    Location
    Fredensborg, Denmark
    Posts
    86
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Convert UK General date format (gdf) to US gdf (Access 2000 sr.1)

    I thought you were referring to display formats only (see my previous reply).
    As for input you you can perfectly well use the US format: jan 17 2002 or jan-17-2002.
    Be carefull not to use the US input format: 1/17/2002 (2002-01-17). It will be allright for that date but for 1/10/2002 it won't work. The latter will be taken as a european date (2002-10-01) when your International settings in the Windows Controlpage are UK settings.
    If you choose to input your dates as jan 17 2002, or jan-17-2002 or 2002-01-17 you'll be allright.

  6. #6
    Star Lounger
    Join Date
    Dec 2001
    Location
    Fredensborg, Denmark
    Posts
    86
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Convert UK General date format (gdf) to US gdf (Access 2000 sr.1)

    Note to my previous reply:
    What I wrote about using a certain US format (like jan-17-2002) was not about defining a format. It was about typing input in that format.

  7. #7
    Lounger
    Join Date
    Nov 2001
    Posts
    38
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Convert UK General date format (gdf) to US gdf (Access 2000 sr.1)

    Try this
    Set the Format to the date field to mmm/dd/yyyy, set the input mask to >L<LL/99/0000;0;_
    Add the following er trapping
    Private Sub Form_Error(DataErr As Integer, Response As Integer)
    If DataErr = 2279 Then
    Me.txtDate.Undo
    MsgBox "Please enter dates as mmm/dd/yyyy eg.Feb 20 2002"
    Response = acDataErrContinue
    Else
    If DataErr = 2113 Then
    Me.txtDate.Undo
    MsgBox "The value you have entered is not a valid date!"
    Response = acDataErrContinue
    Else
    Response = acDataErrDisplay
    End If
    End If
    End Sub

    HTH

Posting Permissions

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