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!

Setting up a form - Word 2003

Status
Not open for further replies.

707kandi

Technical User
Jan 17, 2007
30
US
In helping someone completly redo a report template we ended up making a form so all he has to do is tab and fill in the information. It is a two page form with headers on each page (full header on first page smaller on second). However since this is a report that he has completed numerous times he is aware that it could actually go on for several more pages.

Is there anyway in which we can set it for him so that additional pages (the same as page 2) can automatically be generated if necessary?
 
Yes, probably...no, undoubtably.

However, a bit more detail may be needed. Automatically be generated...based on what criteria?

If it is a form - and I am assuming you are talking about using formfields, and the document is protected for forms - then WHAT would make the document expand to more than what you already have in the form.


"A little piece of heaven
without that awkward dying part."

advertisment for Reese's Peanut Butter Cups (a chocolate/peanut butter confection)

Gerry
 
Actually the first page is just sort of fill in the blanks type info. The second page would be a summary.

Think police reports (similar but that is not what it is) where they have pertinent info on the first page. Then depending on the situation there might be more infor for the second page and possibly even more pages. this individual interviews people and puts together information. Therfore the first page is always the same. He always has a second page. Then sometimes he has more pages to go along with that.

And yes using the forms toolbar, etc.
 
OK, that sounds fairly normal.

And what is stopping things now? What exactly is the problem, if any? What, EXACTLY, are you asking?

"A little piece of heaven
without that awkward dying part."

advertisment for Reese's Peanut Butter Cups (a chocolate/peanut butter confection)

Gerry
 
Ok what I'm asking is this. The form as it stands now is a two page form. If he needs to add further information he would want it to be on a page similar to the second page. But...it seems that when you set up forms that is all there is. In other words you can't just keep adding pages when necessary. At least that is what I'm finding. What I want to know is if there is a way to set up this 2 page form so that if/when necessary he can add further pages to it as he sees fit - that are formatted in the same manner and the first page 2. Hope that makes sense.
 
But you are not stating - in any way - how that page 2 is formatted or set up.

Does page 2 have formfields that need to filled in? If so, does that mean you want to make NEW formfields for the new page (if a new page is needed).

"But...it seems that when you set up forms that is all there is. In other words you can't just keep adding pages when necessary. "

No, you can not. That is the main purpose of having and using forms.

Can it be done to able to add further pages? As I have stated, yes. I will reiterate. Tell us how - EXACTLY - what it is you want to do. I am not a mind reader, and I can not see your page 2. I do not know what is there, so I can not tell you how to do further pages that are formatted like page 2.

What criteria determines if new pages are needed? How do you want to tell Word to make new pages - a button? a shortcut key? If the last formfield on page 2 is a text formfield, and you kept on typing beyond the bottom margin boundary...than that would make a new page all by itself as the text formfield expanded to take the text input.

Is that what you are talking about? I am kidding. I doubt that very much.

Look, I am trying to help. But you need to give us some specific logic to work with.

Say your person has filled out page 1 and page 2, WHAT determines they need a page 3? Do they need the ability to add more than one page? Do you want them to be able to say..give me THREE new pages? Would all the new pages be identical? How do you want you want then to action this?

It could be fairly easily done, like this:

Oh, I need another page. Click a button on a toolbar (or a shortcut key if you prefer) - see below for an example of some code that does this. Another page is made.

OR....do you want to have it that when the user gets to the LAST formfield on page 2, that they get a question box asking if they need another page? That could be done as well.

But what - EXACTLY - does that mean? You state it is like page 2, but we do not know what page 2 is like. If it has formfields that need input, then that means different formfields (by name). This can be done, but it requires precise, exact, statement of requirements.

In any case, because the document is protected for forms, if you want to add anything, the first thing needed is to turn off forms protection.

That moves this into a VBA question. For that reason, if you wish to go forward, I suggest posting to the VBA forum.

Just to give you a taste of what CAN be done - but we still need more details for your specific case:

I just made a document with three formfields on page 1, three formfields on page 2.

The following code is executed by clicking "New Page" on the top toolbar. It is easy to put a call to a procedure as a button (or in this case, text) on a toolbar.
Code:
Option Explicit

Sub MakeNewPage()
Dim r As Range

If ActiveDocument.ProtectionType = wdAllowOnlyFormFields Then
   ActiveDocument.Unprotect
End If
Set r = ActiveDocument.Range
With r
   .Collapse 0
   .InsertBreak Type:=wdPageBreak
   .Collapse 0
End With
With ActiveDocument
   .AttachedTemplate.AutoTextEntries("TestTT").Insert _
        Where:=r, RichText:=True
   .Protect wdAllowOnlyFormFields, NoReset:=True, _
         Password:=""
End With
End Sub
This is only one way to go about this. There are other ways, and which way you use depends on what your EXACT requirements are.

In the code above I used an AutoText entry (essentially the content of my page 2, including formfields). That may not be the best route for you. I do not know, as I do not know what you have on page 2.


"A little piece of heaven
without that awkward dying part."

advertisment for Reese's Peanut Butter Cups (a chocolate/peanut butter confection)

Gerry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top