View Single Post
  #2  
Old March 25th, 2010, 09:17 AM posted to microsoft.public.word.mailmerge.fields
Peter Jamieson
external usenet poster
 
Posts: 4,550
Default Date & Text format in Mail merge

What do you see when the value is ASAP and you use the mergefield with
no format definition, i.e.

{ MERGEFIELD "Date Required" }

?

If you are using Word 2002 or later and you used the default connection
method (OLE DB - if you don't know what connection method you used then
it's almost certainly OLE DB) then you will probably see a time such as

"12:00:00 AM"

In that case you can try

{ IF "{ MERGEFIELD "Date Required" }" = "12:00:00 AM" "ASAP" "{
MERGEFIELD "Date Required" \@"DD/MM/YY" }" }

Each pair of {} needs to be the "special field braces" that you can
insert using ctrl-F9.

If you happen to have connected using ODBC (unlikely these days) then
you will probably see a blank result, and as long as you do not need to
distinguish between ASAP and a blank cell, you can use

{ IF "{ MERGEFIELD "Date Required" }" = "" "ASAP" "{ MERGEFIELD "Date
Required" \@"DD/MM/YY" }" }

If you happen to have connected using DDE (the default in Word 2000 and
earlier), then you should see "ASAP". In that case,

{ MERGEFIELD "Date Required" \@"DD/MM/YY" }

should display the correct result, but if not, you can try

{ IF "{ MERGEFIELD "Date Required" }" = "ASAP" "ASAP" "{ MERGEFIELD
"Date Required" \@"DD/MM/YY" }" }

Although you may be able to fix this by changing your connection method
to DDE, I find it difficult to recommend that these days.

See http://tips.pjmsn.meuk/t0003.htm for further info.

Peter Jamieson

http://tips.pjmsn.me.uk

On 25/03/2010 07:53, Andy Roberts wrote:
I have a spreadsheet which lists jobs and one of the columns is a "required
date" value which sometimes is unknown so instead of a date we input
"ASAP" - this works fine in the spreadsheet.

I then have a mail merge document which brings in the "required date" field
and is formatted as follow:-
{MERGEFIELD Date Required\@"DD/MM/YY"}

This works ok when it is merging a date but doesn't work when it finds
"ASAP" instead of a date. I understand that it is formatted to a date
format which is the problem but if I remove this formatting I get a US date
format. I dont want to leave the excel cell blank as this looks as though
the inputter has missed something.

Is there anyway around this?