Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

If, then statement in Word 1

Status
Not open for further replies.

zatch

MIS
Joined
Oct 11, 2001
Messages
75
Location
US
I am trying to write the following statement in Word for a Mail Merge document:

{IF {MERGEFIELD Date_Enrolled_LVL2} < 1/1/2003 &quot;01/01/2003&quot; {MERGEFIELD Date_Enrolled_LVL2}}

Where the data for {MERGEFIELD Date_Enrolled_LVL2} = 02/11/2003

The result should yield &quot;02/11/2003&quot; in this case, but it is showing &quot;01/01/2003&quot;

Is it not possible to compare date fields when using a MS Word If, then statement in a Mail Merge document?

Thanks.

Zatch
 
If word is taking the dates as text, then 02/11/2003 is less than 1/1/2003. Usually when checking dates, I find it best to reverse them, so in your case it would check 20031102 against 20030101 and give the right answer. But you will have to have another field with the formatted date that you want printed. [pc]

Graham
 
Thanks, Graham. Your tip was helpful. Here is how I accomplished it:

{IF {MERGEFIELD Date_Enrolled_LVL2 \@ &quot;YYYYMMDD&quot;} < 20030101 &quot;01/01/2003&quot; {MERGEFIELD Date_Enrolled_LVL2}}

Zatch
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top