Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mail Merge IF THEN ELSE 1

Status
Not open for further replies.

ikswoktur

Programmer
Oct 11, 2002
29
0
0
US
I am a first-timer mail merge user and i have a data source that contains some PO Boxes. i am trying to create an IF statement with the Insert Word Field that will put the text "PO BOX" before any PO BOX field that isn't blank. Straight-forward enough, but i can't seem to figure out how to get this statement to apply to every record, not just the one selected? Please help...
 
Try:
{IF{MERGEFIELD Address}= "" "" "PO Box {MERGEFIELD Address}"}

Cheers
 
apply to every record, not just the one selected
I assume by this statement that you have set query options which you need to clear by clicking...

Merge... button on the Merge toolbar
Query Options... button
Clear All button

Then define your IF statement to be:
If the PO BOX field is not blank, insert text "PO Box " followed by the PO BOX field.

It should look like:

{IF{MERGEFIELD PO BOX}<>"" "PO Box {MERGEFIELD PO BOX}" ""}
 
i must be thick, this all looks like it would help, but where does Word allow you to place code statements like this? The only place i am have found to set an IF statement is under "Insert Word Field", and in there it is all drop-downs? Thanks
 
is there a way to reaccess the code that pulls in the fields and contains the IF statements? I am getting an error with the IF statement, but i can't modify the code, just start all over again... i am sure i am just missing something.

thanks for the link dcompto, that helped my original problem!
 

Hi, ikswoktur,

ALT+F9 will toggle between viewing the codes and viewing the results. With the codes toggled on, you can edit each character individually. Just remember, if you need to insert, or re-insert, the curly brackets, be sure to use CTRL+F9 to do so. You cannot type each bracket as an individual character.
 
I have seen that, but i can't scroll through all the codes and fields, only those that fit in the lable frame are accessable?
 
In instances like that, I copy only the field (not the frame) and paste it into a new document, edit the code then paste the newly-edited code back into the frame.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top