Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-05-2012, 01:13 PM
ztag ztag is offline 30+ days Variable Day Date Calculations via Fields Windows 7 32bit 30+ days Variable Day Date Calculations via Fields Office 2003
Novice
30+ days Variable Day Date Calculations via Fields
 
Join Date: Jan 2012
Posts: 7
ztag is on a distinguished road
Default 30+ days Variable Day Date Calculations via Fields

First and foremost, I want to thank Macropod and those pertinent to the publishing of the gmayor.com website for all of their great work and resources provided regarding date calculations in Word, amongst other great Word resources.



I am attempting to generally implement what is described in the

http://www.gmayor.com/insert_a_date_...than_today.htm page.

Coming off of the DateCalc V2_8.5, document, I am utilizing the supplied code in "Calculate a day, date, month and year, using n days delay", modified to calculate based on a field called "substantialcomplete" for the original date, and adding a number of days from the field "scopechangedayx". I am doing it in a table, so I have multiple rows for each (up to 20) calculation, and will, therefore, have multiple scopechangeday fields. (Viewing attached document will probably communicate this better)

However, I am having problems in instances in which I need to carryover from one month to the next (37 days added to project, for instance). You can observe in the document that my calcs work for a date calc within a month, but if I add a higher number days, the calculation is erroneous. Similarly, if I change the delay in the datecalc doc formula for n days date calc to 37, the results are similarly invalid.

Am I misinterpreting the intended use of the generously provided formulas, not implementing correctly, or is there another option? Any input on what I am missing here, or suggestions on how to implement what I am trying to do?

It is my understanding that the second 14 in the datecalce document calculation under the aforementioned heading is a part of the calculation formulas, and not an input of the 14-day calc example in the document. Is that correct?

Is it necessary to implement multiple a,b,c,d,jd,e, etc fields in my case, due to the multiple rows/calculations, like I have done in my attached document?

Probably goes without saying - but I "need" to do this using Fields in order to avoid security problems with Macros, as the form is to be widely available.

To clarify - I am trying to add the "change days" values to the the "Orig. date of Subst. Compl." date and display in the Rev. Subst. Compl. column on the first page of the attached file.

Thanks again - Dan
Attached Files
File Type: doc Field Change Order Form - Forums.doc (150.5 KB, 27 views)

Last edited by ztag; 01-05-2012 at 03:43 PM. Reason: clarity
Reply With Quote
  #2  
Old 01-05-2012, 02:56 PM
macropod's Avatar
macropod macropod is offline 30+ days Variable Day Date Calculations via Fields Windows 7 64bit 30+ days Variable Day Date Calculations via Fields Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi Dan,

The field coding works correctly for me. I suspect that your issue is that you're trying to generate output in a DD-MM-YYYY format whereas your system's regional settings are configured for MM-DD-YYYY. The need to modify the field codes for different regional settings is explained in the tutorial's Introduction.

That aside, I'd suggest encoding the field as:
Code:
{QUOTE
{SET StartDate {REF substantialcomplete}}
{SET Delay {REF scopechangeday1}}
{SET a{=INT((14-{StartDate \@ M})/12)}}
{SET b{={StartDate \@ yyyy}+4800-a}}
{SET c{={StartDate \@ M}+12*a-3}}
{SET d{StartDate \@ 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)}}
"{dd}-{mm}-{yy}" \@ "d MMMM yyyy"}
As per the tutorial's 'Date and Time Calculations In A Word Form' topic. And, as per the tutorial's Introduction, you may need to swap the '{dd}-{mm}' portion of the field coding around.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 01-06-2012, 11:12 AM
ztag ztag is offline 30+ days Variable Day Date Calculations via Fields Windows 7 32bit 30+ days Variable Day Date Calculations via Fields Office 2003
Novice
30+ days Variable Day Date Calculations via Fields
 
Join Date: Jan 2012
Posts: 7
ztag is on a distinguished road
Default

Thank you, Macropod.
Reply With Quote
Reply

Tags
field day date

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
30+ days Variable Day Date Calculations via Fields How do I get auto-updated "number of days since specified date" on MS word? terry795 Word 16 01-07-2016 04:33 PM
Variable fields? Emalee77 PowerPoint 0 01-30-2011 05:58 PM
Creating an Auto-Calc'd Date? Today+7 Days? SoCalTelephone Word 0 10-06-2010 10:27 AM
how to make fields calculation variable according to the filter i use duraid Project 0 09-09-2010 01:05 PM
Calculations using values from date picker controls Inkarnate Word 0 06-09-2010 07:16 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:35 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft