PDA

View Full Version : Retain data in Form Fields in a document



JohnnyBravo
12-15-2005, 02:59 PM
Before I started my temp job here, someone created a word document with form fields. These fields are meant to accept both numbers and text. Some of the users of this form are now sending it back to us asking us to fix some formatting issues - those issues are not important. They're more to do with row heigth, etc. So I unlock the document and make the necessary format changes. Problem is that when I lock it back up (forms protection), Word likes to erase everything in those form fields and thus I have to re-enter all the data.

Is it possible to retain the existing data in those fields when I password protect it?

Perhaps there is a better way, but the reason why we are using forms protection is that we don't want the user to input any data except for the checkboxes and form field areas.

I'm using MS Office 2002 (i.e. Office XP).

matthewspatrick
12-15-2005, 03:53 PM
Have you tried setting default values for the fields? You can do that in the properties window.

JohnnyBravo
12-15-2005, 04:27 PM
Have you tried setting default values for the fields? You can do that in the properties window.

I have no idea how that would solve my problem. I think you've misunderstood my question.

When I originally sent these documents out, I had no idea of the flaws in the documents (i.e. the formatting problems I mentioned previously). So when the user gets to about page #9 or so, they realize that the row height is not adjusting to display the entire text.

So I need to make the necessary edits to the document and in order to do that, i need to remove the password protect. No problem there.

But after i make the edits and lock it back up again, Word likes to erase any existing data that was entered by the user in those form fields.

I want to know how to lock it back up (after making the necessary edits) and retain the existing data that the user has put in.

geekgirlau
12-15-2005, 07:58 PM
This according to Help (untested):



When you protect a form by using the Protect Document dialog box (Tools menu, Protect Document command), information in form fields is automatically reset. This does not occur when you protect your document by using the Protect Form button (padlock) on the Forms toolbar.

fumei
12-15-2005, 09:36 PM
It is true. Using the menu resets, using the icon on toolbar does not.

fumei
12-15-2005, 09:41 PM
Or do it by code, like this:
[vba] ActiveDocument.Protect Password:="", NoReset:=True, Type:= _
wdAllowOnlyFormFields/vba]

NoReset:=False is the default.

Funny grammar, should it not be a Reset parameter, rather than a NoReset parameter? Shrug.

JohnnyBravo
12-16-2005, 08:14 AM
Or do it by code, like this:
ActiveDocument.Protect Password:="", NoReset:=True, Type:= _
wdAllowOnlyFormFields

NoReset:=False is the default.

Funny grammar, should it not be a Reset parameter, rather than a NoReset parameter? Shrug.

Unbelieveable. I had no idea the fix was so darn simple! I just had the biggest laugh this morning. Thanks you guys. :)

(BTW, both the VBA & toolbar method works).

fumei
12-16-2005, 09:18 AM
Of course they do.