#1   Report Post  
Gary O
 
Posts: n/a
Default 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   Report Post  
Gary O
 
Posts: n/a
Default

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   Report Post  
Graham Mayor
 
Posts: n/a
Default

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

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel Dates formatting in Word Paul - NottsUK Mailmerge 1 May 22nd 05 08:02 AM
Dates against Word traced changes Rowland Monk Microsoft Word Help 1 May 9th 05 11:57 AM
Tracking Changes - Entering dates of changes Lisa Glase Microsoft Word Help 1 March 3rd 05 10:14 AM
How do I compare dates in a Word IF field? Marion G Microsoft Word Help 0 December 10th 04 01:49 AM
How do I compare dates in a Word IF field? Marion G Microsoft Word Help 0 December 10th 04 01:47 AM


All times are GMT +1. The time now is 07:26 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"