Using dates during mail merge

G

gjupp

Can anybody help please?

Using Word 2000 (9.0.2760) we are in the process of setting up a mail merge
using a standard letter for the main document. The data source comprises in
each record, name, address and other data fields. Data will accumulate slowly
in each record, but we need to carry out mail merges at frequent intervals.

Letters generated during each mail merge must be dated with the current date,
but each date must be retained in the relevant data source records for
generating ‘directories/catalogues’ at a later time (using separate mail
merges) for review. It would also be beneficial for each mail merge to
produce only those letters with the current date, ie. not all record are
merged.

How can this be done, please?

Many thanks in anticipation.
 
D

Doug Robbins - Word MVP

What are you using for the data source? Frankly, it does not sound to me
like mail merge is really the best option for this. How are you proposing
to retain each date in the data source? In a new record? In separate
fields in each record, or multiple dates in one field?

These sort of things need to be considered in the first instance.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
G

gjupp via OfficeKB.com

Thanks for the reply.

For the data source we are using a standard word doc generated by mail merge,
using standard fields for names, address, etc, and we assumed that dates
would be retained in separate fields in each record.

For the moment, until the 'system' is set up, we are entering the current
date manually in date fields for relevant records, then using skip-if (not
equal to this date) to merge only those records. This retains the date but is
crude indeed, as the skip-if date criterion has to be changed for each merge.
There must be a better way. Hope you can help to streamline the process.
Thanks.



What are you using for the data source? Frankly, it does not sound to me
like mail merge is really the best option for this. How are you proposing
to retain each date in the data source? In a new record? In separate
fields in each record, or multiple dates in one field?

These sort of things need to be considered in the first instance.
Can anybody help please?
[quoted text clipped - 18 lines]
Many thanks in anticipation.
 
G

Graham Mayor

You can compare a date in a field with the current date with your skipif
field

{SKIPIF {Mergefield DateField \@ "yyyyMMdd"} <> {Date \@ "yyyyMMdd"}}

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


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Thanks for the reply.

For the data source we are using a standard word doc generated by
mail merge, using standard fields for names, address, etc, and we
assumed that dates would be retained in separate fields in each
record.

For the moment, until the 'system' is set up, we are entering the
current date manually in date fields for relevant records, then using
skip-if (not equal to this date) to merge only those records. This
retains the date but is crude indeed, as the skip-if date criterion
has to be changed for each merge. There must be a better way. Hope
you can help to streamline the process. Thanks.



What are you using for the data source? Frankly, it does not sound
to me like mail merge is really the best option for this. How are
you proposing to retain each date in the data source? In a new
record? In separate fields in each record, or multiple dates in one
field?

These sort of things need to be considered in the first instance.
Can anybody help please?
[quoted text clipped - 18 lines]
Many thanks in anticipation.
 
D

Doug Robbins - Word MVP

You need to consider whether mail merge is really the right tool for this
job.

Maybe something more along the lines of the method contained in the last of
the following series of articles is more appropriate

Please Fill Out This Form
Part 1: Create professional looking forms in Word
http://www.computorcompanion.com/LPMArticle.asp?ID=22

Part 2: Adding Automation to your Word forms.
http://www.computorcompanion.com/LPMArticle.asp?ID=46

Part 3: Learn more VBA (macros) to automate your forms.
http://www.computorcompanion.com/LPMArticle.asp?ID=119

Part 4: Use custom dialog boxes in your Word forms
http://www.computorcompanion.com/LPMArticle.asp?ID=127

Part 5: Connect your AutoForm to a database to save input time and keep
better records!
http://www.computorcompanion.com/LPMArticle.asp?ID=136


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

gjupp via OfficeKB.com said:
Thanks for the reply.

For the data source we are using a standard word doc generated by mail
merge,
using standard fields for names, address, etc, and we assumed that dates
would be retained in separate fields in each record.

For the moment, until the 'system' is set up, we are entering the current
date manually in date fields for relevant records, then using skip-if (not
equal to this date) to merge only those records. This retains the date but
is
crude indeed, as the skip-if date criterion has to be changed for each
merge.
There must be a better way. Hope you can help to streamline the process.
Thanks.



What are you using for the data source? Frankly, it does not sound to me
like mail merge is really the best option for this. How are you proposing
to retain each date in the data source? In a new record? In separate
fields in each record, or multiple dates in one field?

These sort of things need to be considered in the first instance.
Can anybody help please?
[quoted text clipped - 18 lines]
Many thanks in anticipation.
 
G

gjupp via OfficeKB.com

Many thanks indeed. This works fine. However, to go one step further: Is it
possible to compare the current date with a DateField that is formatted
(typed) dd+ordinals MMMMyyyyy?


Graham said:
You can compare a date in a field with the current date with your skipif
field

{SKIPIF {Mergefield DateField \@ "yyyyMMdd"} said:
Thanks for the reply.
[quoted text clipped - 23 lines]
 
G

gjupp via OfficeKB.com

Doug
This is very much the advanced course for me. It will take me some time to
get my head around this technique, but no doubt, it has considrable
advantages over mail merge. I just need to spend the time working on it.
However, many thanks for taking the time to advise. It is much appreciated.


You need to consider whether mail merge is really the right tool for this
job.

Maybe something more along the lines of the method contained in the last of
the following series of articles is more appropriate

Please Fill Out This Form
Part 1: Create professional looking forms in Word
http://www.computorcompanion.com/LPMArticle.asp?ID=22

Part 2: Adding Automation to your Word forms.
http://www.computorcompanion.com/LPMArticle.asp?ID=46

Part 3: Learn more VBA (macros) to automate your forms.
http://www.computorcompanion.com/LPMArticle.asp?ID=119

Part 4: Use custom dialog boxes in your Word forms
http://www.computorcompanion.com/LPMArticle.asp?ID=127

Part 5: Connect your AutoForm to a database to save input time and keep
better records!
http://www.computorcompanion.com/LPMArticle.asp?ID=136
Thanks for the reply.
[quoted text clipped - 24 lines]
 
G

Graham Mayor

I am pretty sure that it is not possible.

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


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Many thanks indeed. This works fine. However, to go one step further:
Is it possible to compare the current date with a DateField that is
formatted (typed) dd+ordinals MMMMyyyyy?


Graham said:
You can compare a date in a field with the current date with your
skipif field

{SKIPIF {Mergefield DateField \@ "yyyyMMdd"} said:
Thanks for the reply.
[quoted text clipped - 23 lines]
Many thanks in anticipation.
 
P

Peter Jamieson

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.

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

gjupp via OfficeKB.com said:
Many thanks indeed. This works fine. However, to go one step further: Is
it
possible to compare the current date with a DateField that is formatted
(typed) dd+ordinals MMMMyyyyy?


Graham said:
You can compare a date in a field with the current date with your skipif
field

{SKIPIF {Mergefield DateField \@ "yyyyMMdd"} said:
Thanks for the reply.
[quoted text clipped - 23 lines]
Many thanks in anticipation.
 
G

gjupp via OfficeKB.com

Yes, you are correct. Please see my reply to Peter Jamieson's suggestion. My
thanks to you for the further advice.


Graham said:
I am pretty sure that it is not possible.
Many thanks indeed. This works fine. However, to go one step further:
Is it possible to compare the current date with a DateField that is
[quoted text clipped - 10 lines]
 
G

gjupp via OfficeKB.com

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 said:
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]
 
G

Graham Mayor

You can add an ask field to collect the date at the start of the merge eg

{ ASK MyDate "Start Date" \d { Date \@ "dd/MM/yyyy} \o }{ SKIPIF {
Mergefield Date \@ "yyyyMMdd"} <> { REF MyDate \@ "yyyyMMdd "} }

The default date in that field is today's date, but it can be changed at the
prompt.

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


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
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 said:
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.
 
P

Peter Jamieson

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"

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

gjupp via OfficeKB.com said:
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 said:
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.
 
G

Graham Mayor

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


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

Peter said:
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 said:
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 said:
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.
 
P

Peter Jamieson

Thanks Graham - I was using 2007 but will try 2003 now.

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

Graham Mayor said:
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


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

Peter said:
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 said:
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.
 
P

Peter Jamieson

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
http://tips.pjmsn.me.uk

Peter Jamieson said:
Thanks Graham - I was using 2007 but will try 2003 now.

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

Graham Mayor said:
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


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

Peter said:
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"


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.
 
G

Graham Mayor

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


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

Peter said:
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 said:
Thanks Graham - I was using 2007 but will try 2003 now.

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

Graham Mayor said:
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

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

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"


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.
 
G

gjupp via OfficeKB.com

Many thanks indded for this. I will try it out over the coming weekend and
let you know the result.
I am very grateful for your time



Graham said:
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.
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
[quoted text clipped - 86 lines]
 
G

gjupp via OfficeKB.com

I tried this and it works just fine. Many thanks indeed for your help. It is
much appreciated. Graham Mayor also came up with a solution which I couldn't
make work. Please see my reply to his last input.

Peter said:
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"
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.
[quoted text clipped - 38 lines]
 
G

gjupp via OfficeKB.com

Many thanks for this. I tried it out but couldn't make it work. I even tried
'tweaking' spaces and quotes (very much groping in the dark) to see it this
would do the trick. You included 'MyDate' and 'Date2' in your construction
but I cannot understand the function of 'Date2'. It is probably this element
that I have got wrong.

Peter Jamieson has suggested a solution that I have been able to make work.
This is great and really deals with my oringinal request. However, it is
irritating that I have not been able to make your 'ASK' routine to function
properly. If you have time to clarify, I shall be grateful. Please don'y
bother if you are too busy. Many thanks again.


Graham said:
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.
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
[quoted text clipped - 86 lines]
 

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