Results 1 to 3 of 3
  1. #1
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unusual Date Format in VBA (2003)

    On the startup form of the attached mdb, select Alto Mora and click the "Inserimento Dati" button.
    In the form that opens up, if you select 1st May 2007 on the calendar and click the "Inserire Data" button, you get an error message:
    Date syntax error in the query expression 'Giorno= #01/mag/2007#'.
    and the code stops at the line:
    If Format(CGior, "yyyymmdd") = Format(DLookup("giorno", "amdati", "Giorno= #" & Format(CGior, "dd/mmm/yyyy") & "#"), "yyyymmdd") Then

    If I change the language settings in the control panel from Italian to English, such error does not occur.
    How can I solve this problem since users' pc's need to have the language set to Italian?
    Attached Files Attached Files

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

    Re: Unusual Date Format in VBA (2003)

    DLookup expects US date format, so use

    If Format(CGior, "yyyymmdd") = Format(DLookup("giorno", "amdati", "Giorno= #" & Format(CGior, "mm/dd/yyyy") & "#"), "yyyymmdd") Then

    This should work in any language setting.

  3. #3
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Unusual Date Format in VBA (2003)

    Thank you Hans <img src=/S/smile.gif border=0 alt=smile 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
  •