Prevent pages from displaying/printing

J

Jamie

I'm not very VBA or SQL literate so I'm trying to figure a way to make this
form work.

I created a form out of a word document. It populates bookmarks and
references with data from a SQL database. The form is static. It allows up to
9 employees names, addresses, etc to display.

For example:
Laura Smith
15 Street Princeton, NY 08696
US citizen

Larry Kole
58 Rd New York, NY 90012
UK citizen

Jen Reilly
40 Avenue Miami, FL 10012
FR citizen

So there are 3 employees that print per page. So I end up having 3 pages
each everytime.

My problem is that I don't always have 9 employees everytime. Sometimes I
may just have one which would
only need to print on page 1 or four employees which would print on 2 pages.

Is there any way to write a macro that will prevent pages from displaying
and printing depending the
the number of employees. So if there are 3 employees then page 1 will print.
If there are 4 to 6 employees then page 2 will print.
If there are more than 6 employees pages 1 thru 3 will display and print.

Any suggestions? Many thanks Microsoft experts
 
W

Word Heretic

G'day "Jamie" <[email protected]>,

I would start with a blank template with some autotext for each
insertion chunk.

Then, for each group of three users add this autotext and populate it.
If you must use bookmarks to mark the spot, use this logic:

While PeopleLeftToReport > 0

Insert autotext at end of doc
Populate bookmarks with 3 people
Delete bookmarks
Decrement PeopleLeftToReport by 3
Wend

Steve Hudson - Word Heretic

steve from wordheretic.com (Email replies require payment)
Without prejudice


Jamie reckoned:
 

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