Comparing Dates

G

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
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
 
G

Gary O

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top