If Statements in Word 2007 How To?

J

JohnH

I have seen many post on how to suppress blanks lines in a merge ( address
line 2 is blank so don't print it). My Problem is I cannot figure out how to
write the If statment. I've seen posts that show the actual merge with the IF
in it but for the life of me I can not reporduce it. I've tried the Rule
option but I can't figure how to enter the merge fields.. I tried typing
directly into the doc but that gets treated as text. I know I'm just missing
some simple process step but I cannot figure it out or find it in help. MS
Word help does not seem to address this process. I can find unlimited methods
to skip records but not blank fields. The address block is not an option
because it cannot be mapped accurately with the data files I work with plus
it always comes in as 1.5 spacing and I can't turn that off. To make a long
story short hwo do I enter if address_line_2 is blank skip it and print/merge
the city,st,zip line right beneath address_line_1

Thanks
John
 
G

Graham Mayor

Use CTRL+F9 to enter each pair of field brackets then

{Mergefield Address_Line_1}{IF{Mergefield Address_Line_2} <> "" "
{Mergefield Address_Line_2}"}
{Mergefield City} etc


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


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
J

Joe Murphy

I have seen many post on how to suppress blanks lines in a merge ( address
line 2 is blank so don't print it). My Problem is I cannot figure out how to
write the If statment. I've seen posts that show the actual merge with the IF
in it but for the life of me I can not reporduce it. I've tried the Rule
option but I can't figure how to enter the merge fields.. I tried typing
directly into the doc but that gets treated as text.

Very likely, you need to insert the brackets around the field
properly. Are you typing the brackets?

Don't type the brackets. Instead, highlight the text you want to make
a field and hit Ctrl+F9. That will add the brackets and turn it into a
field.

So you start with, say, MERGEFIELD Date, select both words, hit Ctrl
+F9 and get {MERGEFIELD Date}.

Alt+F9 toggles the visibility of all fields, too.

Joe.
 
J

JohnH

YES!!! Thanks Graham & Joe. I almost got it. I'm still having trouble getting
the non blank addr2 on a seperate line without a blank line in between Addr1
& 2. I tried an enter and a shift enter but both produce a blank line between
addr1 & 2

Thanks so much.
 
J

JohnH

Actuall Graham I'm all set I think? It appears to be an anomaly? The first
time I look at a record with addr2 it shows a blank line between addr1 & 2
but if I cursor back and forth ti appeas fine. Appears fine in print as well.

Thanks Again
John
 
G

Graham Mayor

Merge to a new document to test.

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


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

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