View Single Post
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Merge field+if statement+phone numbers

If you insert

{ MERGEFIELD EmployerPhone }

what results do you see?

Where you have blank in Excel, do you get blank in Word? Or do you sometimes
get 0 or even 0.0 ?

Where you have a phone number such as 5551234567 in Excel, what do you see
in Word?
5551234567 ?
(555)-123-4567 ?
or perhaps even
5551234567.0 ?

If you only ever get blank or 5551234567, then

{ MERGEFIELD EmployerPhone \#"(000)'-'000'-'0000" }

should be enough. If you get 0 where you have blank in Excel, you can try

{ IF { MERGEFIELD EmployerPhone } 0
"{ MERGEFIELD EmployerPhone \#"(000)'-'000'-'0000" }"
"" }

(You don't have to split it across rows as I have done).

Peter Jamieson

"John" wrote in message
news
I have a form file in Word 2000 that merges with an Excel Database. One of
my fields is a telephone number.

I want to do two things with that telephone number. One format as (000)
000-0000 and if that Excel telephone field is blank when the merge takes
place, I do not want the telephone number to print at all. I want the
field
to appear blank on the final merged document. However, if there is a
telephone number in that field then I want the telephone number to print
in
the format shown above.

I have tried several versions of an if statement and cannot seem to obtain
the correct statement.

Here is what I have tried:

{IF{MERGEFIELD EmployerPhone}"""{MERGEFIELD EmployerPhone}"}

Also tried:

{IF{MERGEFIELD EmployerPhone\#"(000)'-'000'-'0000"}"""{MERGEFIELD
EmployerPhone\#"(000)'-'000'-'0000"}"}

and also:

{MERGEFIELD EmployerPhone\#"(000)'-'000'-'0000"}{IF{MERGEFIELD
EmployerPhone\#"(000)'-'000'-'0000"}"""{MERGEFIELD
EmployerPhone\#"(000)'-'000'-'0000"}"}

What am I doing wrong. I have tried merging with files that contain
telephone numbers and are blank. My results are not consistent. I can
get
it to print in the format I want depending on the above statement
variation,
but not consistently blank when the field is blank and not consistently
print
the phone number when the filed is not blank.

Help!!!

AJ

--
John R.