Home |
Search |
Today's Posts |
#1
|
|||
|
|||
Comparing Dates
I am trying to merge data from my Access database to a Word document. I am
trying to show in my Word document either the amount in the field for NovRent or MayRent depending on the dates entered in NovRentDate and MayRentDate. Code: {If {MERGEFIELD NovRentDate}{MERGEFIELD MayRentDate} {MERGEFIELD NovRent} {MERGEFIELD MayRent}} My current scenario: If 5/02/2005 (NovRentDate) 2/07/2005 (MayRentDate) then display $217.40 (NovRent) otherwise display $123.80 (MayRent) My document displays $217.40 whereas it should display $123.80 as MayRentDate is after NovRentDate. I am using Australian Date Format (dd/mm/yyyy). How can I get Word to compare the year, month and day as I think it is currently only comparing the start of each date and therefore 5/02/2005 is greater than 2/07/2005. Any support will be greatly appreciated. Regards Gary |
#2
|
|||
|
|||
I think I have worked this out.
I created two calculated fields in Access called WORDNovRentDate and WORDMayRentDate and formated them to be a General Number based on the NovRentDate and MayRentDate field dates. Word can then compare the General Number and determine which is the greater or lesser and display the correct rent amount - either MayRent or NovRent. If there is a better (or more correct) method of achieving this, please let me know. Regards Gary O "Gary O" wrote: I am trying to merge data from my Access database to a Word document. I am trying to show in my Word document either the amount in the field for NovRent or MayRent depending on the dates entered in NovRentDate and MayRentDate. Code: {If {MERGEFIELD NovRentDate}{MERGEFIELD MayRentDate} {MERGEFIELD NovRent} {MERGEFIELD MayRent}} My current scenario: If 5/02/2005 (NovRentDate) 2/07/2005 (MayRentDate) then display $217.40 (NovRent) otherwise display $123.80 (MayRent) My document displays $217.40 whereas it should display $123.80 as MayRentDate is after NovRentDate. I am using Australian Date Format (dd/mm/yyyy). How can I get Word to compare the year, month and day as I think it is currently only comparing the start of each date and therefore 5/02/2005 is greater than 2/07/2005. Any support will be greatly appreciated. Regards Gary |
#3
|
|||
|
|||
See the method for comparing dates shown at
http://www.gmayor.com/formatting_word_fields.htm -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Gary O wrote: I think I have worked this out. I created two calculated fields in Access called WORDNovRentDate and WORDMayRentDate and formated them to be a General Number based on the NovRentDate and MayRentDate field dates. Word can then compare the General Number and determine which is the greater or lesser and display the correct rent amount - either MayRent or NovRent. If there is a better (or more correct) method of achieving this, please let me know. Regards Gary O "Gary O" wrote: I am trying to merge data from my Access database to a Word document. I am trying to show in my Word document either the amount in the field for NovRent or MayRent depending on the dates entered in NovRentDate and MayRentDate. Code: {If {MERGEFIELD NovRentDate}{MERGEFIELD MayRentDate} {MERGEFIELD NovRent} {MERGEFIELD MayRent}} My current scenario: If 5/02/2005 (NovRentDate) 2/07/2005 (MayRentDate) then display $217.40 (NovRent) otherwise display $123.80 (MayRent) My document displays $217.40 whereas it should display $123.80 as MayRentDate is after NovRentDate. I am using Australian Date Format (dd/mm/yyyy). How can I get Word to compare the year, month and day as I think it is currently only comparing the start of each date and therefore 5/02/2005 is greater than 2/07/2005. Any support will be greatly appreciated. Regards Gary |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel Dates formatting in Word | Mailmerge | |||
Dates against Word traced changes | Microsoft Word Help | |||
Tracking Changes - Entering dates of changes | Microsoft Word Help | |||
How do I compare dates in a Word IF field? | Microsoft Word Help | |||
How do I compare dates in a Word IF field? | Microsoft Word Help |