Removing spaces

C

Christine

I'm not sure I've been able to find my exact situation so I hope I'm not
duplicating questions. I've seen some solutions that seem close to what I'm
looking for but they look much more complicated than what I think I need.

Here is the problem. I have a Word main merge document with the following
text relating to client phone numbers:
Home:
Cell:
Work:

The phone number source info is from an Access database. In many cases, I
don't have all of the client's phone numbers and if a number does not exist I
would like the line to disappear. For example, I want this appearance

Home: 555-5555
Work: 555-1111

when I don't have a cell number.

Is there a simple way to do this?

Thanks for your help.
 
R

Rich/rerat

Christine,
Try inserting the following, if you are using a field called "cellphone".

{if{Mergefield cellphone}<>"" {Mergefield cellphone} \b "Cellphone: " ""}
Make sure you add a space after the colon :)) and the quote marks (")

Remember you need insert the field, you cannot just type "{}".

--
Add MS to your News Reader: news://msnews.microsoft.com
Rich/rerat
(RRR News) <message rule>
<<Previous Text Snipped to Save Bandwidth When Appropriate>>


I'm not sure I've been able to find my exact situation so I hope I'm not
duplicating questions. I've seen some solutions that seem close to what I'm
looking for but they look much more complicated than what I think I need.

Here is the problem. I have a Word main merge document with the following
text relating to client phone numbers:
Home:
Cell:
Work:

The phone number source info is from an Access database. In many cases, I
don't have all of the client's phone numbers and if a number does not exist
I
would like the line to disappear. For example, I want this appearance

Home: 555-5555
Work: 555-1111

when I don't have a cell number.

Is there a simple way to do this?

Thanks for your help.
 
C

Christine

Thank you, Rich. I've tried this but it won't work. I've evidently got
something wrong. I copied your formula exactly, except I changed the field
name to Cell which is the fieldname in the table. Then I pasted the formula
into the merge doc after the field 'Cell'. Actually, I tried a number of
variations of placement but didn't get anywhere. Can you tell me where I
insert the formula exactly?

Thank you,
Christine
 
R

Rich/rerat

Christine,
Sorry I gave you the wrong information.

In the word document, Set up the merge for a directory, use Access as you
database.
Insert the fields for:
<<Name>>
<<Home>>
<<Cell>>
<<Work>>

Now Right click each phone field> Select Toggle Field Codes, and add the
following switch:
\b "FieldName: "

So you will have the following in your document:
<<Name>>
{Mergefield Home \b "Home: "}
{Mergefield Cell \b "Cell: "}
{Mergefield Work \b "Work: "}
<Space> (This will separate each Record when the Merge is finished)
<Space>
Then Merge to New Document

--
Add MS to your News Reader: news://msnews.microsoft.com
Rich/rerat
(RRR News) <message rule>
<<Previous Text Snipped to Save Bandwidth When Appropriate>>


Thank you, Rich. I've tried this but it won't work. I've evidently got
something wrong. I copied your formula exactly, except I changed the field
name to Cell which is the fieldname in the table. Then I pasted the formula
into the merge doc after the field 'Cell'. Actually, I tried a number of
variations of placement but didn't get anywhere. Can you tell me where I
insert the formula exactly?

Thank you,
Christine
 
G

Graham Mayor

You cannot paste fields. Fields brackets {} must be inserted with CTRL+F9

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


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
C

Christine

Hi, Rich.
Well, I finally got this to work. I'm so grateful for your help. Thank you!
Everything is working as expected - there's just a little glitch with spacing
between the field name and contents when the phone number is there but I can
work with that by using extra spaces in the code and get it pretty close to
the appearance I want. Howeve, if you know of any other magic that might
correct this, I'd be happy to hear about it. Otherwise, it's great.

Thanks again!
Christine
 
R

Rich/rerat

Christine,
So you will have the following in your document:
<<Name>>
{Mergefield Home \b "Home: "}
{Mergefield Cell \b "Cell: "}
{Mergefield Work \b "Work: "}
<Space> (This will separate each Record when the Merge is finished)
<Space>

What you can now do is add an "IF" field to each line:
1. First one at a time, right click each field, Toggle Field Code, and
delete the switch, "\b "fieldname: ".
2. Mouse click, right at the beginning of the mergefield you created.
3. Select the Mergefield toolbar> Insert Word Field> Select "If.., then"
wizard> so for the Home phone line you would do:
If Field Home "Is Not Blank"> In the first text box type "Home:" (w/o
quotes). 4. Now press the TAB button twice (x2), this will move the
mergefield for the number to the right.
5. Repeat steps #3 & #4, for the other phone fields. You can also do this
for the NAME: line to.

So it would something like this

{if.., then...} {mergefield name}
{if.., then...} {mergefield home}
{if.., then...} {mergefield cell}
{if.., then...} {mergefield work}

Name: John
Cell: 555-1236

Name: sally
Home: 555-1236
Work: 555-1238

Name: donna
Home: 555-1237
Cell: 555-1238
Work: 1-554-555-1239

Name: harold
Cell: 555-1239
Work: 555-1240

Name: sammy
Home: 555-1239
Cell: 555-1240

Name: Mrs Smith
Home: 1-201-356-2519
Cell: 1-201-356-2520
Work: 1-201-356-2521

Now this will still align the data left to right. So for the phone #'s, you
may need to make sure that the data is in the same format. So if use area
codes for long distance #'s, you will need to use them for the local
numbers, if you want to keep the alignment. But not necessary. Also for the
"Title" of the
line, I would recommend that you capitalize the whole word, since you are
using just 4 letters for the "Title". You may have to experiment with
different fonts to get the desired effect that you want. It might not be
perfect, but you can get close to what you want. As seen in my example
above, but some of the formatting is lost because the message is in Plain
Text, and the message was created in Georgia font.
--
Add MS to your News Reader: news://msnews.microsoft.com
Rich/rerat
(RRR News) <message rule>
<<Previous Text Snipped to Save Bandwidth When Appropriate>>


Hi, Rich.
Well, I finally got this to work. I'm so grateful for your help. Thank you!
Everything is working as expected - there's just a little glitch with
spacing
between the field name and contents when the phone number is there but I can
work with that by using extra spaces in the code and get it pretty close to
the appearance I want. However, if you know of any other magic that might
correct this, I'd be happy to hear about it. Otherwise, it's great.

Thanks again!
Christine
 

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