Reply
 
Thread Tools Display Modes
  #1   Report Post  
amoss
 
Posts: n/a
Default Synchronizing two form fields.


As someone inputs information into one form field how do I get it to be
copied to either another form entry or any other part of the same word
document?


--
amoss
  #2   Report Post  
Pyth007
 
Posts: n/a
Default


amoss Wrote:
As someone inputs information into one form field how do I get it to be
copied to either another form entry or any other part of the same word
document?


There are a couple of ways to do this depending upon what exactly you
mean by "As someone inputs...."

If you mean "after a person types in info. into the form field and then
hits enter or TABs away to the next field", then you can simply write a
macro that functions On Exit (double-clicking an unlocked form-field
will show an On Entry and On Exit properties that allow you to specify
macro names that should be run accordingly). To get the info. to be
copied from one field into another:
* Make a macro called (CopyInfo; or whatever name you want to give it);
go to Tools-Macros-Macros... Then type in a name for the macro, select a
location (eg associate the macro with the particular document instead of
with Normal.dot so that any other Word document you create won't have
that macro saved as worthless overhead.) And then hit the Create
button. This will bring you into the Macro VBA environment.

* Type in the code

Code:
--------------------
ActiveDocument.Formfields("txtOriginalInfo").Resul t = _
ActiveDocument.FormFields("txtInfoCopy").Result
--------------------

where "txtOriginalInfo" is the name of the field that you want the
person to enter the info into (and the one where this macro will be run
On Exit) and
"txtCopyInfo" is the field that will have the copy of the info.

* Save Macro and go back to the Word document.

* Double-click the unprotected field ("txtOriginalInfo") and type the
name of the macro you created (CopyInfo) into the On Exit property.

* Also if you haven't already done so, name the field to reflect what
you wrote in the macro by changing the name property (and do the same
for the "txtCopyInfo" field)

* Save the document and you're good to go!

If when you said "As someone inputs...." you meant "the person hits a
letter and the letter become visible in two fields at exactly the same
time", then you're question becomes much more tricky (something that I
won't try to answer in this post). Basically for this, you would have
to run a macro On Entry which looks at your keystrokes as you type them
in and echo that into the other field. I'm not sure if it was this
forum, but I remember reading a post about an Autocomplete macro for
FormFields which acts similar to the address-bar in IE that fills in
what it expects you to type in next. If I remember correctly, this
macro went more into having something happen as keys were being
pressed; in that case instead of having the keystrokes echoed in a
different field, it had to look up similar words and write out those to
the current field.

Unless you were trying to make your document really flashy, I'd just
stick with the simple macro that I gave in the first solution.

P.S. You can also use conditional statements to automate more of your
document. For example, suppose you had a field for the zip-code and you
had a commonly typed in zip-code (like your home address), then you
might have this code in your macro:

Code:
--------------------
If ActiveDocument.FormFields("homeZipCode").Result = "14218" Then
ActiveDocuments.FormFields("homeCity").Result = "Buffalo"
ActiveDocuments.FormFields("homeState").Result = "NY"
End If
--------------------


EDIT: I just went back into Word and realized I had misnamed some of
the properties for the FormField. The name of the formfield can be
entered in the "Bookmark:" field in the "Field Settings" section. And
the Macro that you want to run on exit out of the formfield is listed
in the drop-down list under "Exit:" under the "Run macro on" section.


--
Pyth007
  #3   Report Post  
Suzanne S. Barnhill
 
Posts: n/a
Default

No macro is needed for this, just a cross-reference to the bookmark of your
form field. See http://gregmaxey.mvps.org/Repeating_Data.htm

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

"amoss" wrote in message
...

As someone inputs information into one form field how do I get it to be
copied to either another form entry or any other part of the same word
document?


--
amoss


Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Blank return for drop-down form fields Peter B. Microsoft Word Help 4 January 26th 07 05:01 PM
Mailmerge vs. form fields Candace Mailmerge 1 September 8th 05 07:14 PM
How do I use a form then mailmerge without losing the form fields Someone who's stuck Mailmerge 1 June 23rd 05 10:01 AM
Having multiple form fields automatically updated jrwaguespack Microsoft Word Help 3 March 25th 05 07:43 AM
Email a protected document that contains Text Form Fields Dowza New Users 1 January 8th 05 10:31 AM


All times are GMT +1. The time now is 11:54 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"