Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement,microsoft.public.word.mailmerge.fields
JethroUK© JethroUK© is offline
external usenet poster
 
Posts: 110
Default IF 06/11/2007 23/10/2007 = is "True" isn't it?

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?

  #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?



  #3   Report Post  
Posted to microsoft.public.word.docmanagement,microsoft.public.word.mailmerge.fields
JethroUK© JethroUK© is offline
external usenet poster
 
Posts: 110
Default IF 06/11/2007 23/10/2007 = is "True" isn't it?

Brilliant! - Oh what a clever chap you are - it makes so much sense too -
thanks thanks thanks

I can now get on with the rest of my life - Thankyooooooooooooooooooo!!!!!!!



"Jay Freedman" wrote in message
...
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?




  #4   Report Post  
Posted to microsoft.public.word.docmanagement,microsoft.public.word.mailmerge.fields
macropod macropod is offline
external usenet poster
 
Posts: 1,002
Default IF 06/11/2007 23/10/2007 = is "True" isn't it?

Hi Jethro

Just in case you need to do anything more esoteric with dates in Word, check out my Date Calc 'tutorial', at:
http://www.wopr.com/cgi-bin/w3t/show...?Number=249902
or
http://www.gmayor.com/downloads.htm#Third_party

Cheers
--
macropod
[MVP - Microsoft Word]
-------------------------

"JethroUK©" wrote in message ...
Brilliant! - Oh what a clever chap you are - it makes so much sense too - thanks thanks thanks

I can now get on with the rest of my life - Thankyooooooooooooooooooo!!!!!!!



"Jay Freedman" wrote in message ...
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?





  #5   Report Post  
Posted to microsoft.public.word.docmanagement,microsoft.public.word.mailmerge.fields
JethroUK© JethroUK© is offline
external usenet poster
 
Posts: 110
Default IF 06/11/2007 23/10/2007 = is "True" isn't it?

In early help with this very IF function, Peter, Graham & indeed yourself
posted this very same date syntax for comparison, but for some reason i was
so tied into the function i completely failed to even notice the format or
the significance of year/month/day - so for that i extend my thanks & i'll
check out the articles


"macropod" wrote in message
...
Hi Jethro

Just in case you need to do anything more esoteric with dates in Word,
check out my Date Calc 'tutorial', at:
http://www.wopr.com/cgi-bin/w3t/show...?Number=249902
or
http://www.gmayor.com/downloads.htm#Third_party

Cheers
--
macropod
[MVP - Microsoft Word]
-------------------------

"JethroUK©" wrote in message
...
Brilliant! - Oh what a clever chap you are - it makes so much sense too -
thanks thanks thanks

I can now get on with the rest of my life -
Thankyooooooooooooooooooo!!!!!!!



"Jay Freedman" wrote in message
...
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?





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
IF 06/11/2007 23/10/2007 = is "True" isn't it? JethroUK© Microsoft Word Help 4 October 23rd 07 11:41 PM
Word 2007: "Keep with next" and "Widow Lines" features not workin Tina Microsoft Word Help 3 October 5th 07 07:18 AM
Word 2007 view defaults to "Thumbnails" rather than "Document Map" Bruggie Microsoft Word Help 1 March 1st 07 08:19 PM
Word 2007 and Powerpoint 2007 "close window" button mikegbuff Microsoft Word Help 6 February 2nd 07 05:56 PM
How do I convert all "NAME" to "Name" in MS Word 2007 document? michael in bath nc Microsoft Word Help 1 August 15th 06 10:14 AM


All times are GMT +1. The time now is 12:42 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"