Results 1 to 5 of 5
  1. #1

    Access -> Word DocProperty Fields show wrong date!

    Hi All

    Bit of a weird one this ...

    I have a mySQL database which I update using an Access front end form. The date format within mySQL is YYYY-MM-DD. When I view my DB using the form, the date is in the form DD/MM/YY which is fine (I'm in the UK and therefore prefer this layout).

    However, the problems start when I pass a date value to the DocProperties in a Word document. I use Helen Feddema's excellent code (<A target="_blank" HREF=></A> - Accesss -> Word No.2 - Writing an Access Contact to a Word Letter) and the line .Item("DateDue").Value = Nz(Me![txtDateDue]) passes the date to the Word DocProperty.

    Non-Weird Situation:
    The date in Record 1 appears as 17/04/01 (i.e. the 17th April 2001 which is correct) and when I pass this to Word it appears as 4/17/01 if I apply NO formatting to the DocProperty (i.e. no date switch). However, if I use dd MMMM yy as a switch, the date appears as 17 April 01 - PERFECT! The way I want it! However ...

    Weird Situation:
    If I use the same date switch for Record 2 in my DB things go wrong. The date in Record 2 appears as 02/06/01 (i.e. the 2nd June 2001 which is correct). When I pass this to Word using the same date switch as before the date appears as 06 February 01! NOT what I want!

    Does anyone know what is going wrong and why the SAME formatting switch produces two DIFFERENT date styles? Any help would be appreciated as this is making me go crazy!

    Cheers, Kenny.

  2. #2
    Beth Eveland

    Re: Access -> Word DocProperty Fields show wrong date!

    Kenny, just curious did you try using no switch on record number 2?

  3. #3

    Re: Access -> Word DocProperty Fields show wrong date!

    Record 2 with no switch results in 6/2/01 - i.e. 6th February 2001 instead of 2nd June 2001. AAAGH!

    Any ideas?


  4. #4

    Re: Access -> Word DocProperty Fields show wrong date!

    Just a guess.....

    I would guess that with a date where the day and the month can be switched and still make sense, i.e., 02/06/01, versus one that does not make sense, i.e., 17/04/01, that on the one which can go either way, Word reverts to its "native" format.

    Another thought. How are your system dates set up? U.S. (mm/dd/yyyy) or international (dd/mm/yyyy)? Could that be a factor?

  5. #5
    Star Lounger
    Join Date
    Jan 2001
    Adelaide, South Australia, Australia
    Thanked 0 Times in 0 Posts

    Re: Access -> Word DocProperty Fields show wrong date!

    You could try explicitly formating the date using Format:

    .Item("DateDue").Value = Format(Nz(Me![txtDateDue]), "dd mmm yyyy")

    so that the value passed is unambigous.


Posting Permissions

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