Mailmerge Date field comparison in Word2003

G

Gavin Clark

We are trying to compare a mailmerge imported date value, with either another
mailmerge imported date value, or a fixed date we define as text. For
example:

{IF{{MERGEFIELD "DATE1"} > {MERGEFIELD "DATE2"} "A" "B"}}

However the two dates do not seem to compare correctly and we do not get the
correct results.

Is there some mechanism by which such date 'values' need to be converted to
true 'equivalent' internal Word Date values before they can be compared, or
are we just completely wrong in what we are trying to achieve

Many thanks in the hope of some help

Gavin Clark
Occam Systems, UK
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?R2F2aW4gQ2xhcms=?=,

the word.mailmerge.fields newsgroup would probably be the better place to ask
this than a programming group, but...

Generally Word doesn't do too well with date calculations/comparisons. It's
always a question whether Word interprets what it sees as a date, what date
format it's going to use if it does, and whether it feels it can "do that
today". Generally, if at all possible, I do date stuff in a query/formula in the
data source, before it ever gets to Word.

That said, if you're patient you can force the issue by breaking down the date
using date switches. Sorta like this

{ If { Mergefield Date1 \@ "yyyy" } > { Mergefield Date2 \@ "yyyy" } "A" "{ IF
{ Mergefield Date1 \@ "M" } > { Mergefield Date2 \@ "M" } "A" "{ IF
{ Mergefield Date1 \@ "d" } > { Mergefield Date2 \@ "d" } "A" "B" }" }" }
We are trying to compare a mailmerge imported date value, with either another
mailmerge imported date value, or a fixed date we define as text. For
example:

{IF{{MERGEFIELD "DATE1"} > {MERGEFIELD "DATE2"} "A" "B"}}

However the two dates do not seem to compare correctly and we do not get the
correct results.

Is there some mechanism by which such date 'values' need to be converted to
true 'equivalent' internal Word Date values before they can be compared, or
are we just completely wrong in what we are trying to achieve

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 

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