View Single Post
  #2   Report Post  
Posted to microsoft.public.word.docmanagement,microsoft.public.word.mailmerge.fields
Jay Freedman Jay Freedman is offline
external usenet poster
 
Posts: 9,854
Default IF 06/11/2007 23/10/2007 = is "True" isn't it?

Hi Jethro,

What you're missing is that Word fields don't do date arithmetic. The
results of the two internal fields beign compared here are _strings_ and the
"greater than" comparison is doing an alphanumeric comparison of those
strings. So whenever the day number of the merge field is less than the day
number of today -- in your example, "06" is alphanumerically less than
"23" -- the result of the comparison is False. It has nothing to do with US
vs. UK or what Word "thinks" of the date.

The only reliable way to express dates so they can be compared
alphanumerically is with the format "yyyyMMdd", in decreasing unit order.
Try rewriting the first part of your field as

If { MERGEFIELD Myfield \@ "yyyyMMdd" } { DATE \@ "yyyyMMdd" }

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

JethroUK© wrote:
This is slowly (nay quickly) driving me insane - I have an mailmerge
IF condition to help me spot pending appointments easily

If { MERGEFIELD Myfield \@ "dd/MM/yyyy" } { DATE \@ "dd/MM/yyyy" }
{ MERGEFIELD Myfield \@ "ddd dd MMM hh:mm" } {MERGEFIELD Myfield \@
"dd/MM"}
pseudo = If myfield is after today (pending) then, display mydate in
long date format, else mydate as short date format e.g.:

IF 31/10/2007 23/10/2007 = "Wed 31 Oct 07:00" = great

IF 22/10/2007 23/10/2007 = "22/10" = great


After a week of (seemingly) no problems - Today I uncovered a gremlin


IF 06/11/2007 23/10/2007 is returning "06/11" ????? - that's True
isn't it?


I have always had problems getting MS Word (XP 2002) to interpret
UK/English dates - I thought after DDE connection (albeit it very
incovenient) my troubles were over
Just looking at these examples myself (as i type here) I can see that
despite 06/11/2007 displayed in full, formatted correctly (UK
day/month), interpreted (from XL) & displayed correctly, connected as
DDE - this is 'still' just a fudge for the folks over in blighty - it
is clearly evident that MS Word 'still' thinks this is US 11th June
2007 & i am about to try few more dates to confirm it

Is it fair to say MS Word just doesn't know what day it is? Or am I
missing something obvious or do I give up gracefully?