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
Prev Previous Post   Next Post Next
  #16  
Old February 12th, 2008, 05:43 PM posted to microsoft.public.word.mailmerge.fields
Peter Jamieson
external usenet poster
 
Posts: 4,550
Default Using dates during mail merge

Where Graham has "date2" you need to put the name of the field in the data
source that you want to compare with (i.e. that has the date in "1st
February 2008" format)

(i.e. Graham's example has used the name "date2" where my example has used
"mydatetext", but in both cases you need to substitute the name in your data
source.)

Other than that, AFAICS, Graham's fields should work - if you change the two
{ DATE } fields in my example so that instead of looking like

{ DATE .... }

they look like

{ REF MyDate .... }

you should be there. In theory there's a typo (unusual for him :-) ) in
Graham's code:

{ ASK MyDate "Start Date" \d { Date \@ "dd/MM/yyyy} \o }

should have an extra quote:

{ ASK MyDate "Start Date" \d { Date \@ "dd/MM/yyyy" } \o }

but in practice it works as it is.

I'd select your field codes and press F9 to re-execute them after you change
them.

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

"gjupp via OfficeKB.com" u41094@uwe wrote in message
news:7fa15597a8bdf@uwe...
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 02:31 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.