Can I insert a conditional page break using field codes?

R

Risseecm

I need to insert a page break if a condition is true. For example, if the
Name field for the next record is different, print on a new page, otherwise
continue on the same page.
 
G

Graham Mayor

{IF {Mergefield fieldname} = "True" "insert a page break here"}

In the above construction insert a page break where indicated between the
quote marks. You will have to build this manually using CTRL+F9 for the
field boundaries. And the actual result of the mergefield when inserted
normally must be "True"

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


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
R

Risseecm

Thank you, Graham. I'm guessing I don't actually type "insert a page break
here", but I don't know the code to type in for a page break. Can you help
with this?
 
G

Greg

Risseecm,

Graham meant to be taken literally. Remove the text -insert text break
here- from between the " " marks and with your cursor between the marks
actually insert a page break.
 
R

Risseecm

Thanks, Greg. I've tried to insert a page break by pressing CTRL-ENTER and
by inserting it from the Insert menu and both methods simply move the text to
a new page rather than inserting a field code to activate when the condition
is true. I'm using Word 2003.
 
G

Greg

RIsseecm,

Try this test.

Type True

Select it and bookmark with the name Test

Type this text IF Test = "True"""""

Select that and press CTRL+F9

Put your cursor between the first pair of empty speech marks and insert
a page break. Insert>Break>Page Break

That is it. You need to physically insert the page break in the field
code. When you toggle the field code the break with appear in the
document as long as the condition Test is "True" if you change the
value of the condition and update the field the page break will not
appear in the document.
 
R

Risseecm

Greg,

I tried the test you suggested and it again simply put a page break in my
typed text rather than inserting it after evaluating the formula. Here's my
formula:

{IF {MERGEFIELD "Supv_Name"}<>{SUPV} "New" "Same"}

{SUPV} is a stored value containing the current supervisor's name. I'm
trying to put the page break where I have typed New so that if the data shows
a supervisor that's different from the current value, the next data set will
print on a new page. I don't know if this matters, but I have this formula
in a table.

Any suggestions?
 
G

Greg

Risseecm,

That is how it works. Because the page break is in the field code,
when you toggle the field code the page break "will be there" IF the
condition is TRUE and "will not be there" IF the condition is false.
 

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