Results 1 to 2 of 2
  1. #1
    New Lounger
    Join Date
    Oct 2012
    Thanked 0 Times in 0 Posts

    Date Calculation


    I found the lounge trying to perform date calculations in form fields. Thanks for the excellent information in the from macropod. I have read it, and also received help from

    Hopefully this is an easy one for you guys. The date calculation below, will not update with yesterdays date when it should, rather it displays the date from the last time it was opened before 0800. I can manually update and it will calculate yesterdays date properly if the current hour is less than 0800. The next time I open it and the hour is less than 0800, it will show a previously calculated yesterdays date from the last time I updated. If I open the document after 0800 it always shows the proper current date with no manual intervention. Can you guys help me figure out why it requires a nudge to everytime to generate yesterdays date?

    { IF { TIME \@ "HH" } < 08 "{QUOTE
    {SET Delay -1}
    {SET a{=INT((14-{DATE \@ M})/12)}}
    {SET b{={DATE \@ yyyy}+4800-a}}
    {SET c{={DATE \@ M}+12*a-3}}
    {SET d{DATE \@ d}}
    {SET jd{=d+INT((153*c+2)/5)+365*b+INT(b/4)-INT(b/100)+INT(b/400)-32045+Delay}}
    {SET e{=INT((4*(jd+32044)+3)/146097)}}
    {SET f{=jd+32044-INT(146097*e/4)}}
    {SET g{=INT((4*f+3)/1461)}}
    {SET h{=f-INT(1461*g/4)}}
    {SET i{=INT((5*h+2)/153)}}
    {SET dd{=h-INT((153*i+2)/5)+1}}
    {SET mm{=i+3-12*INT(i/10)}}
    {SET yy{=100*e+g-4800+INT(i/10)}}
    "{mm}-{dd}-{yy}" \@ "MMMM d, yyyy"}" "{DATE \@ "MMMM d, yyyy" }"}

    Thank you for any help.

    BTW- Im using Word 2003

  2. #2
    Super Moderator
    Join Date
    May 2002
    Canberra, Australian Capital Territory, Australia
    Thanked 452 Times in 372 Posts
    That's just the nature of calculated fields - unless you do something to cause them to recalculate, they'll continue to display the last-calculated value. FWIW, a print preview should be sufficient to trigger an update.

    Paul Edstein
    [MS MVP - Word]

Posting Permissions

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