Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Mailmerge and Fax / June 2005

Tip: Looking for answers? Try searching our database.

Comparing Dates

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Gary O - 28 Jun 2005 07:11 GMT
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
Gary O - 28 Jun 2005 08:16 GMT
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

> 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
[quoted text clipped - 21 lines]
>
> Gary
Graham Mayor - 28 Jun 2005 13:19 GMT
See the method for comparing dates shown at
http://www.gmayor.com/formatting_word_fields.htm

Signature

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor -  Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

> I think I have worked this out.
>
[quoted text clipped - 39 lines]
>>
>> Gary

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.