A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » Mailmerge
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Using dates during mail merge



 
 
Thread Tools Display Modes
  #11  
Old February 7th, 2008, 02:23 PM posted to microsoft.public.word.mailmerge.fields
gjupp via OfficeKB.com
external usenet poster
 
Posts: 10
Default Using dates during mail merge

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

  #12  
Old February 7th, 2008, 03:07 PM posted to microsoft.public.word.mailmerge.fields
Graham Mayor
external usenet poster
 
Posts: 18,297
Default Using dates during mail merge

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

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


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



  #13  
Old February 7th, 2008, 04:05 PM posted to microsoft.public.word.mailmerge.fields
Peter Jamieson
external usenet poster
 
Posts: 4,550
Default Using dates during mail merge

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" u41094@uwe wrote in message
news:7f606d68464d2@uwe...
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


  #14  
Old February 7th, 2008, 04:41 PM posted to microsoft.public.word.mailmerge.fields
Graham Mayor
external usenet poster
 
Posts: 18,297
Default Using dates during mail merge

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@uwe...
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



  #15  
Old February 7th, 2008, 04:58 PM posted to microsoft.public.word.mailmerge.fields
Peter Jamieson
external usenet poster
 
Posts: 4,550
Default Using dates during mail merge

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

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

"Graham Mayor" wrote in message
...
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@uwe...
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




  #16  
Old February 7th, 2008, 05:19 PM posted to microsoft.public.word.mailmerge.fields
Peter Jamieson
external usenet poster
 
Posts: 4,550
Default Using dates during mail merge

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" wrote in message
...
Thanks Graham - I was using 2007 but will try 2003 now.

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

"Graham Mayor" wrote in message
...
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@uwe...
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





  #17  
Old February 8th, 2008, 10:09 AM posted to microsoft.public.word.mailmerge.fields
Graham Mayor
external usenet poster
 
Posts: 18,297
Default 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" wrote in message
...
Thanks Graham - I was using 2007 but will try 2003 now.

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

"Graham Mayor" wrote in message
...
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@uwe...
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



  #18  
Old February 8th, 2008, 02:17 PM posted to microsoft.public.word.mailmerge.fields
gjupp via OfficeKB.com
external usenet poster
 
Posts: 10
Default Using dates during mail merge

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 Mayor wrote:
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]
--
Message posted via http://www.officekb.com


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...merge/200802/1

  #19  
Old February 12th, 2008, 05:56 PM posted to microsoft.public.word.mailmerge.fields
gjupp via OfficeKB.com
external usenet poster
 
Posts: 10
Default Using dates during mail merge

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

[quoted text clipped - 38 lines]

Many thanks in anticipation.


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...merge/200802/1

  #20  
Old February 12th, 2008, 06:17 PM posted to microsoft.public.word.mailmerge.fields
gjupp via OfficeKB.com
external usenet poster
 
Posts: 10
Default Using dates during mail merge

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 Mayor wrote:
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]
--
Message posted via http://www.officekb.com


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...merge/200802/1

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:39 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.