A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Autopopulating a form field from a drop down form field



 
 
Thread Tools Display Modes
  #1  
Old July 16th, 2004, 11:31 PM
Shannon
external usenet poster
 
Posts: n/a
Default Autopopulating a form field from a drop down form field

I have created a form in Word. One of the fields is a drop-down box (yes/no). Based on what they select in this drop down box, I would like another field (regular text field) to automatically populate with pre-defined text. Does anyone know how to do this?

Shannon
  #2  
Old July 17th, 2004, 02:06 AM
Shauna Kelly
external usenet poster
 
Posts: n/a
Default Autopopulating a form field from a drop down form field

Hi Shannon

This is a two-step process.

Step 1: Create a macro like the following:

Sub UpdateTextFormField()

With ActiveDocument

If .FormFields("DropDown1").Result = "Yes" Then
.FormFields("Text1").Result = "You chose yes"

ElseIf .FormFields("DropDown1").Result = "No" Then
.FormFields("Text1").Result = "You chose no"

End If

End With

End Sub

If you're not sure what to do with that macro, see
http://www.gmayor.com/installing_macro.htm

You will need to edit that macro in three ways:
(a) Change the name of the drop down field to match the name of your drop
down field
(b) Change the name of the text field to match the name of your text field
(c) Change the text you want to display in the text field.

Note that it's a good idea to give your fields meaningful names. You can
change the name by turning off protection, then right-clicking the field.
Names like txtCompanyName are more useful than "Text1".

I would also change the name of the macro (ie the word after Sub). Call it
something more specific like UpdateEmployeeStatus or UpdateCustomerName.

Step 2: Tell the drop down field to run the macro when the user exits the
drop down field. To do that, turn off protection on the form. Right-click
the field and choose Properties. In the Exit box, select your macro.

Turn protection on, and test it out.

Hope this helps.

Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word


"Shannon" wrote in message
...
I have created a form in Word. One of the fields is a drop-down box

(yes/no). Based on what they select in this drop down box, I would like
another field (regular text field) to automatically populate with
pre-defined text. Does anyone know how to do this?

Shannon



  #3  
Old July 17th, 2004, 02:24 AM
Jay Freedman
external usenet poster
 
Posts: n/a
Default Autopopulating a form field from a drop down form field

Hi Shannon,

For purposes of illustration, I'll assume the dropdown form field has
the default name Dropdown1 and that you put in the items Yes and No.
You should also check the 'Calculation on exit' box in the Properties
dialog.

In the other place, do not put a text form field. Instead, put in this
field, using Ctrl+F9 to insert each matching pair of field braces:

{ IF {Dropdown1} = "Yes" "text for yes" "text for no" }

The Yes in this field must match the Yes item in the dropdown,
including capitalization. Replace the two text items with whatever
text you need for your form. Press F9 to collapse the field code, and
protect the form. When the user changes the dropdown and tabs to
another form field, the IF field will automatically update to the
corresponding text.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://www.mvps.org/word

"Shannon" wrote:

I have created a form in Word. One of the fields is a drop-down box (yes/no). Based on what they select in this drop down box, I would like another field (regular text field) to automatically populate with pre-defined text. Does anyone know how to do this?

Shannon


  #4  
Old July 17th, 2004, 02:43 AM
Shauna Kelly
external usenet poster
 
Posts: n/a
Default Autopopulating a form field from a drop down form field

Hi Shannon

Jay Freedman's solution is both simpler and better than the one I proposed.
Use Jay's proposal!

Hope this helps.

Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word


"Jay Freedman" wrote in message
...
Hi Shannon,

For purposes of illustration, I'll assume the dropdown form field has
the default name Dropdown1 and that you put in the items Yes and No.
You should also check the 'Calculation on exit' box in the Properties
dialog.

In the other place, do not put a text form field. Instead, put in this
field, using Ctrl+F9 to insert each matching pair of field braces:

{ IF {Dropdown1} = "Yes" "text for yes" "text for no" }

The Yes in this field must match the Yes item in the dropdown,
including capitalization. Replace the two text items with whatever
text you need for your form. Press F9 to collapse the field code, and
protect the form. When the user changes the dropdown and tabs to
another form field, the IF field will automatically update to the
corresponding text.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://www.mvps.org/word

"Shannon" wrote:

I have created a form in Word. One of the fields is a drop-down box

(yes/no). Based on what they select in this drop down box, I would like
another field (regular text field) to automatically populate with
pre-defined text. Does anyone know how to do this?

Shannon




  #5  
Old July 17th, 2004, 02:51 AM
Tammy Richardson
external usenet poster
 
Posts: n/a
Default Autopopulating a form field from a drop down form field

Insert field using the drop down field from the Forms
toolbar then double click on the field to get the dialog
box that will allow you to enter your list of options.
It is limited in 2002 to 25 entries.
-----Original Message-----
I have created a form in Word. One of the fields is a

drop-down box (yes/no). Based on what they select in
this drop down box, I would like another field (regular
text field) to automatically populate with pre-defined
text. Does anyone know how to do this?

Shannon
.

  #6  
Old July 17th, 2004, 02:53 AM
Tammy Richardson
external usenet poster
 
Posts: n/a
Default Autopopulating a form field from a drop down form field

Sorry I did not see your entire question and I do not
know the answer.
-----Original Message-----
I have created a form in Word. One of the fields is a

drop-down box (yes/no). Based on what they select in
this drop down box, I would like another field (regular
text field) to automatically populate with pre-defined
text. Does anyone know how to do this?

Shannon
.

  #7  
Old March 20th, 2008, 07:27 PM posted to microsoft.public.word.docmanagement
Bryan
external usenet poster
 
Posts: 344
Default Autopopulating a form field from a drop down form field

I have tried this with Word2000 and am having no luck.
I have 3 items in dropox and have done this
{IF {Dropdown1} = " " " " {IF {Dropdown1} = "Steve" "call" {IF {Dropdown1} =
"Mitch" "fax" }}}

When I select 'our' or 'Steve' from the dropbox, I am getting nothing

What am I missing?

"Jay Freedman" wrote:

Hi Shannon,

For purposes of illustration, I'll assume the dropdown form field has
the default name Dropdown1 and that you put in the items Yes and No.
You should also check the 'Calculation on exit' box in the Properties
dialog.

In the other place, do not put a text form field. Instead, put in this
field, using Ctrl+F9 to insert each matching pair of field braces:

{ IF {Dropdown1} = "Yes" "text for yes" "text for no" }

The Yes in this field must match the Yes item in the dropdown,
including capitalization. Replace the two text items with whatever
text you need for your form. Press F9 to collapse the field code, and
protect the form. When the user changes the dropdown and tabs to
another form field, the IF field will automatically update to the
corresponding text.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://www.mvps.org/word

"Shannon" wrote:

I have created a form in Word. One of the fields is a drop-down box (yes/no). Based on what they select in this drop down box, I would like another field (regular text field) to automatically populate with pre-defined text. Does anyone know how to do this?

Shannon



  #8  
Old March 21st, 2008, 06:15 AM posted to microsoft.public.word.docmanagement
Graham Mayor
external usenet poster
 
Posts: 18,297
Default Autopopulating a form field from a drop down form field

For three entries
Mitch
Steve
and a single space -
{ IF{ Dropdown1 } " " "{ IF { Dropdown1 } = "Steve" "Call" "{ If{
Dropdown1 } = "Mitch" "Fax" " " }" }" " " }
will work, provided you have calculate on exit flagged on the dropdown1
field and you tab out of it.

Alternatively you could use a selection of fields on the same line to cover
every eventuality.
{ If{ Dropdown1 } = "Mitch" "Fax"}{ If{ Dropdown1 } = "Steve" "Call" }{
If{ Dropdown1 } = " " " " }

You made no mention of 'our' and that appears irrelevant from the field
information you have provided.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



bryan wrote:
I have tried this with Word2000 and am having no luck.
I have 3 items in dropox and have done this
{IF {Dropdown1} = " " " " {IF {Dropdown1} = "Steve" "call" {IF
{Dropdown1} = "Mitch" "fax" }}}

When I select 'our' or 'Steve' from the dropbox, I am getting nothing

What am I missing?

"Jay Freedman" wrote:

Hi Shannon,

For purposes of illustration, I'll assume the dropdown form field has
the default name Dropdown1 and that you put in the items Yes and No.
You should also check the 'Calculation on exit' box in the Properties
dialog.

In the other place, do not put a text form field. Instead, put in
this field, using Ctrl+F9 to insert each matching pair of field
braces:

{ IF {Dropdown1} = "Yes" "text for yes" "text for no" }

The Yes in this field must match the Yes item in the dropdown,
including capitalization. Replace the two text items with whatever
text you need for your form. Press F9 to collapse the field code, and
protect the form. When the user changes the dropdown and tabs to
another form field, the IF field will automatically update to the
corresponding text.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://www.mvps.org/word

"Shannon" wrote:

I have created a form in Word. One of the fields is a drop-down
box (yes/no). Based on what they select in this drop down box, I
would like another field (regular text field) to automatically
populate with pre-defined text. Does anyone know how to do this?

Shannon



  #9  
Old March 24th, 2008, 02:10 PM posted to microsoft.public.word.docmanagement
Bryan
external usenet poster
 
Posts: 344
Default Autopopulating a form field from a drop down form field

Good Morning,
I've done this but, still no luck.
I Ctrl+F9 after my drop down and insert the code listed and then F9. I lock
the template and then save it. When I create new doc and select either name,
I get nothing.

I've used macros on exit to poulate a text but, this looked simpler.
What am I missing?

Bryan

"Graham Mayor" wrote:

For three entries
Mitch
Steve
and a single space -
{ IF{ Dropdown1 } " " "{ IF { Dropdown1 } = "Steve" "Call" "{ If{
Dropdown1 } = "Mitch" "Fax" " " }" }" " " }
will work, provided you have calculate on exit flagged on the dropdown1
field and you tab out of it.

Alternatively you could use a selection of fields on the same line to cover
every eventuality.
{ If{ Dropdown1 } = "Mitch" "Fax"}{ If{ Dropdown1 } = "Steve" "Call" }{
If{ Dropdown1 } = " " " " }

You made no mention of 'our' and that appears irrelevant from the field
information you have provided.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



bryan wrote:
I have tried this with Word2000 and am having no luck.
I have 3 items in dropox and have done this
{IF {Dropdown1} = " " " " {IF {Dropdown1} = "Steve" "call" {IF
{Dropdown1} = "Mitch" "fax" }}}

When I select 'our' or 'Steve' from the dropbox, I am getting nothing

What am I missing?

"Jay Freedman" wrote:

Hi Shannon,

For purposes of illustration, I'll assume the dropdown form field has
the default name Dropdown1 and that you put in the items Yes and No.
You should also check the 'Calculation on exit' box in the Properties
dialog.

In the other place, do not put a text form field. Instead, put in
this field, using Ctrl+F9 to insert each matching pair of field
braces:

{ IF {Dropdown1} = "Yes" "text for yes" "text for no" }

The Yes in this field must match the Yes item in the dropdown,
including capitalization. Replace the two text items with whatever
text you need for your form. Press F9 to collapse the field code, and
protect the form. When the user changes the dropdown and tabs to
another form field, the IF field will automatically update to the
corresponding text.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://www.mvps.org/word

"Shannon" wrote:

I have created a form in Word. One of the fields is a drop-down
box (yes/no). Based on what they select in this drop down box, I
would like another field (regular text field) to automatically
populate with pre-defined text. Does anyone know how to do this?

Shannon




  #10  
Old March 24th, 2008, 02:36 PM posted to microsoft.public.word.docmanagement
Jay Freedman
external usenet poster
 
Posts: 9,488
Default Autopopulating a form field from a drop down form field

You can't do this with only one Ctrl+F9. Each pair of matching braces must
be inserted with Ctrl+F9 -- you should be creating fields within fields, but
simply pasting in the text from the post gives you just text, not fields.

You could paste in the text from the post, then select the text between one
pair of matching braces -- for example, Dropdown1 -- and press Ctrl+F9 to
make that field; then delete the plain-text braces and leave only the field
delimiters. Repeat that for each of the other pairs.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

bryan wrote:
Good Morning,
I've done this but, still no luck.
I Ctrl+F9 after my drop down and insert the code listed and then F9.
I lock the template and then save it. When I create new doc and
select either name, I get nothing.

I've used macros on exit to poulate a text but, this looked simpler.
What am I missing?

Bryan

"Graham Mayor" wrote:

For three entries
Mitch
Steve
and a single space -
{ IF{ Dropdown1 } " " "{ IF { Dropdown1 } = "Steve" "Call" "{ If{
Dropdown1 } = "Mitch" "Fax" " " }" }" " " }
will work, provided you have calculate on exit flagged on the
dropdown1 field and you tab out of it.

Alternatively you could use a selection of fields on the same line
to cover every eventuality.
{ If{ Dropdown1 } = "Mitch" "Fax"}{ If{ Dropdown1 } = "Steve" "Call"
}{ If{ Dropdown1 } = " " " " }

You made no mention of 'our' and that appears irrelevant from the
field information you have provided.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



bryan wrote:
I have tried this with Word2000 and am having no luck.
I have 3 items in dropox and have done this
{IF {Dropdown1} = " " " " {IF {Dropdown1} = "Steve" "call" {IF
{Dropdown1} = "Mitch" "fax" }}}

When I select 'our' or 'Steve' from the dropbox, I am getting
nothing

What am I missing?

"Jay Freedman" wrote:

Hi Shannon,

For purposes of illustration, I'll assume the dropdown form field
has the default name Dropdown1 and that you put in the items Yes
and No. You should also check the 'Calculation on exit' box in the
Properties dialog.

In the other place, do not put a text form field. Instead, put in
this field, using Ctrl+F9 to insert each matching pair of field
braces:

{ IF {Dropdown1} = "Yes" "text for yes" "text for no" }

The Yes in this field must match the Yes item in the dropdown,
including capitalization. Replace the two text items with whatever
text you need for your form. Press F9 to collapse the field code,
and protect the form. When the user changes the dropdown and tabs
to another form field, the IF field will automatically update to
the corresponding text.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://www.mvps.org/word

"Shannon" wrote:

I have created a form in Word. One of the fields is a drop-down
box (yes/no). Based on what they select in this drop down box, I
would like another field (regular text field) to automatically
populate with pre-defined text. Does anyone know how to do this?

Shannon



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Updating a field on a continous form David Batt Using Forms 1 July 5th, 2004 03:30 PM
Passing value to modal child form in MS Access using VBA? Grahammer Using Forms 6 July 4th, 2004 11:53 PM
Drop Down form field miskmh General Discussion 1 June 9th, 2004 06:07 PM
Textbox field, fill using query based on value of id field on form Michael Miller Using Forms 0 June 8th, 2004 06:31 PM
drop down form field miskmh New Users 1 May 15th, 2004 06:03 AM


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


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.