Re: Using dates during mail merge



It appears there were two issues that prevented this from working here as
intended

1. I was using an ASK field to collect the date to compare thus

{ ASK MyDate "Start Date" \d { Date \@ "dd/MM/yyyy} \o }{ SKIPIF {
MERGEFIELD Date2 } <> "{ REF MyDate \@ "d " \*Ordinal}{ REF MyDate \@ " MMMM
yyyy" }" }

Unfortunately I was using one of my test data files which also had a field
called MyDate (unused in the merge) which conflicted with the bookmark of
the same name. With that fieldname changed it worked.

2. This construction will not work for a range of dates eg

{ ASK MyDate "Start Date" \d { Date \@ "dd/MM/yyyy} \o }{ SKIPIF {
MERGEFIELD Date2 } > "{ REF MyDate \@ "d " \*Ordinal}{ REF MyDate \@ " MMMM
yyyy" }" }

for that type of range you cannot compare dates with ordinal fields and must
revert to the switch I posted earlier. You cannot derive a date in the
format \@ "yyyyMMdd" from a field containing ordinal text.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

Peter Jamieson wrote:
Seems OK in both 2003 and 2000, with or without the quotes, which
leads me to wonder whether we are attempting the same thing and/or
whether I have missed a vital piece of information. SKIPIF can
certainly be touchy in some cases.


"Peter Jamieson" <pjj@xxxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:uTYhsJaaIHA.5088@xxxxxxxxxxxxxxxxxxxxxxx
Thanks Graham - I was using 2007 but will try 2003 now.

--
Peter Jamieson
http://tips.pjmsn.me.uk

"Graham Mayor" <gmayor@xxxxxxxxxxxxxxxxxx> wrote in message
news:%23miUn$ZaIHA.3756@xxxxxxxxxxxxxxxxxxxxxxx
Hmmmm. I couldn't get it to work in Word 2003 - though I didn't
have the quotes around "{ MERGEFIELD mydatetext }"
I'll play again tomorrow :(

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

Peter Jamieson wrote:
OK, it certainly works here, i.e. in principle, so maybe the detail
needs checking:

preferably with a space
between month and year.

I suspected as much :-)

{ SKIPIF "{ MERGEFIELD mydatetext }" <> "{ DATE \@"D" \*Ordinal }{
DATE \@" MMMM YYYY" }" }

works OK here with that spec. All the {} have to be ctrl-F9 braces
as usual, and the spacing and quoting is obviously import -

either one space between the two DATE fields and

\@"MMMM YYYY"

or no space between the two DATE fields and

\@" MMMM YYYY"


"gjupp via OfficeKB.com" <u41094@uwe> wrote in message
news:7f606d68464d2@xxxxxx
Yes, this is the comparison that I wish to make, preferably with a
space between month and year. And yes, we wish to make a 'not
equal' comparison. I tried your suggestion, but the merge
returned nil results. Word
date format
(language 'English (UK)') was set to 'dd MMMM yyyy' without
ordinal. However,
this may have no relevance.

Unless your suggested SKIPIF syntax can be modified, I suppose it
will not be
possible to achieve my aim. If so, I shall continue to use SKIPIF
with the comparison date manually inserted at each merge. This
will be crude, but the
method will work.

Many thanks indeed for your advice. It is very useful.



Peter Jamieson wrote:
You mean compare with things that are in your data source like

7th February2008
1st March2008

etc?

As long as you can use date and numeric field switches that
generate precisely the date format you need to compare with, you
should be able to use a simlar technique, e.g.

{ SKIPIF "{ MERGEFIELD mydatetext }" <> "{ DATE \@"D" \*Ordinal
}{ DATE \@"
MMMMYYYY" }" }

Haven't tried it myself though, and at best you will only be able
to do exact comparisons (equal or not equal), not determine
whether one date is before the other.

Many thanks indeed. This works fine. However, to go one step
further: Is it
[quoted text clipped - 11 lines]

Many thanks in anticipation.

--
Message posted via http://www.officekb.com


.



Relevant Pages

  • Re: Using date fields in merge
    ... Graham Mayor - Word MVP ... Word MVP web site http://word.mvps.org ... In order to compare dates you have to be ...
    (microsoft.public.word.mailmerge.fields)
  • Re: Documents Jumping Back to the Beginning....
    ... but I'm not using any "compare" functions... ... have both documents open in separate windows and toggle between them by ... Terry Farrell - MS Word MVP ... In the process of editing papers, it is common for me to have more ...
    (microsoft.public.word.newusers)
  • Re: Documents Jumping Back to the Beginning....
    ... If you're using Compare Side by Side With, ... Terry Farrell - MS Word MVP ... In the process of editing papers, it is common for me to have more than ...
    (microsoft.public.word.newusers)
  • Re: Skip Record If
    ... Word MVP web site http://word.mvps.org ... multiple "Skip Record Ifs"? ... disregarding all my other "compare to's. ...
    (microsoft.public.word.docmanagement)
  • Re: Can I compare more than two merge field values using =AND or =
    ... Word MVP web site http://word.mvps.org ... It works fine when I try and compare ... the values of two mergefields: ...
    (microsoft.public.word.mailmerge.fields)

Loading