#1   Report Post  
Posted to microsoft.public.word.docmanagement
airhockeycanada airhockeycanada is offline
external usenet poster
 
Posts: 10
Default Form Fields

I am working with Microsoft Word 2002. I have a form created. One of the
fields is a drop-down list with 5 selections. These selections are sales rep
codes. We have another field which displays the sales rep name. What I want
to do is when a sales rep code is selected from the drop-down list, I want
the corresponding sales rep name to appear in the sales rep name field.

How do I accomplish this? I am not knowledgeable about VB at all. I have
tried using the Insert, Field and using an IF command but, ran into a
roadblock when it didn't seem to work and not sure what I'm doing wrong.

Thanks for your help on this in advance.

--
S. Ross
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Suzanne S. Barnhill Suzanne S. Barnhill is offline
external usenet poster
 
Posts: 33,624
Default Form Fields

You'll need nested IF fields. See the "Specify multiple conditions" portion
of the Help topic "Examples of IF fields."

--
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.

"airhockeycanada" wrote in message
...
I am working with Microsoft Word 2002. I have a form created. One of the
fields is a drop-down list with 5 selections. These selections are sales

rep
codes. We have another field which displays the sales rep name. What I

want
to do is when a sales rep code is selected from the drop-down list, I want
the corresponding sales rep name to appear in the sales rep name field.

How do I accomplish this? I am not knowledgeable about VB at all. I have
tried using the Insert, Field and using an IF command but, ran into a
roadblock when it didn't seem to work and not sure what I'm doing wrong.

Thanks for your help on this in advance.

--
S. Ross


  #3   Report Post  
Posted to microsoft.public.word.docmanagement
Suzanne S. Barnhill Suzanne S. Barnhill is offline
external usenet poster
 
Posts: 33,624
Default Form Fields

Your problem is that you're using form fields, not merge fields. What you
want is just the bookmark name, and note that a form field has a built-in
bookmark (which you can modify in the Form Field Options); you don't have to
insert a bookmark manually, and in fact if you do, it will likely be
overwritten when the field is used. Try setting the built-in bookmark to
RepCode, then using the field { IF RepCode = "100" "Dave Smith" "{..., etc.

--
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.

"airhockeycanada" wrote in message
news
Well, I did try that and it didn't work. I know it's something I did wrong
but, not sure what. This is what the Help topic states to do and I believe
this is in the field where the rep's name would appear:

{IF {MERGEFIELD State} = "CA" "For California residents, we offer special
rates to Asia and Japan." "{IF {MERGEFIELD State} = "WA" "For Washington
residents, we offer special rates to Asia and Japan." " "} "}

So, I did the following (by the way I have bookmarked my rep code field
RepCode):

{IF {MERGEFIELD RepCode} = "100" "Dave Smith" "{IF {MERGEFIELD RepCode} =
"101" "Sue Worthy" " "} "}

As an added problem, my RepCode bookmark seems not to be saving. When I
bring up the file again and check that the field is still bookmarked as
RepCode the bookmark is empty. Why is it not saving?

Finally, when adding an IF field the allowable space for the IF string is
not long enough for me to check for all our rep codes. Is there a solution

to
this?

Thanks.


--
S. Ross


"Suzanne S. Barnhill" wrote:

You'll need nested IF fields. See the "Specify multiple conditions"

portion
of the Help topic "Examples of IF fields."

--
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.

"airhockeycanada" wrote in message
...
I am working with Microsoft Word 2002. I have a form created. One of

the
fields is a drop-down list with 5 selections. These selections are

sales
rep
codes. We have another field which displays the sales rep name. What I

want
to do is when a sales rep code is selected from the drop-down list, I

want
the corresponding sales rep name to appear in the sales rep name

field.

How do I accomplish this? I am not knowledgeable about VB at all. I

have
tried using the Insert, Field and using an IF command but, ran into a
roadblock when it didn't seem to work and not sure what I'm doing

wrong.

Thanks for your help on this in advance.

--
S. Ross




  #4   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Form Fields

Suzanne has largely covered this, but the conditional field does not put the
information in another form field. To do that you will need to use vba. To
use conditional fields, they must go in the body of the document and the
calculate on exit check box property of the RepCode form field must be
checked. This will update the conditional fields but not if it is in the
header or footer. For those to update you will need to run a macro on exit
from the form field. I recommend also that you don't nest the fields but
concatenate them e.g.
{IF {REF State} = "CA" "For California residents, we offer special rates to
Asia and Japan."}{IF {REF State} = "WA" "For Washington residents, we offer
special rates to Asia and Japan."}etc

and

{IF {REF RepCode} = "100" "Dave Smith"}{IF {REF RepCode} = "101" "Sue
Worthy"}etc

then lock the form to allow the form fields to work.

If you want to run update code on exit from a field you'll find suitable
code at http://www.gmayor.com/installing_macro.htm

If you want to populate a form field (here shown as bookmark name RepName)
based on the content of a dropdown field (bookmark name RepCode) using vba
then you need something similar to the following, run on exit from the
dropdown field RepCode.

Sub OnExitRepCode()
'fills text form field based on content of a form field

Dim oFld As FormFields
Set oFld = ActiveDocument.FormFields
Select Case oFld("RepCode").Result
Case Is = "100"
oFld("RepName").Result = "Dave Smith"
Case Is = "101"
oFld("RepName").Result = "Sue Worthy"
Case Else
'Do nothing
End Select
End Sub


similarly the State version

Sub OnExitState()
Dim oFld As FormFields
Set oFld = ActiveDocument.FormFields
Select Case oFld("State").Result
Case Is = "CA"
oFld("Offer").Result = "For California residents, we offer special rates
to Asia and Japan."
Case Is = "WA"
oFld("Offer").Result = "For Washington residents, we offer special rates
to Asia and Japan."
Case Else
'Do nothing
End Select
End Sub

--

Graham Mayor - Word MVP

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




airhockeycanada wrote:
Well, I did try that and it didn't work. I know it's something I did
wrong but, not sure what. This is what the Help topic states to do
and I believe this is in the field where the rep's name would appear:

{IF {MERGEFIELD State} = "CA" "For California residents, we offer
special rates to Asia and Japan." "{IF {MERGEFIELD State} = "WA" "For
Washington residents, we offer special rates to Asia and Japan." " "}
"}

So, I did the following (by the way I have bookmarked my rep code
field RepCode):

{IF {MERGEFIELD RepCode} = "100" "Dave Smith" "{IF {MERGEFIELD
RepCode} = "101" "Sue Worthy" " "} "}

As an added problem, my RepCode bookmark seems not to be saving. When
I bring up the file again and check that the field is still
bookmarked as RepCode the bookmark is empty. Why is it not saving?

Finally, when adding an IF field the allowable space for the IF
string is not long enough for me to check for all our rep codes. Is
there a solution to this?

Thanks.



You'll need nested IF fields. See the "Specify multiple conditions"
portion of the Help topic "Examples of IF fields."

--
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.

"airhockeycanada" wrote in message
...
I am working with Microsoft Word 2002. I have a form created. One
of the fields is a drop-down list with 5 selections. These
selections are sales rep codes. We have another field which
displays the sales rep name. What I want to do is when a sales rep
code is selected from the drop-down list, I want the corresponding
sales rep name to appear in the sales rep name field.

How do I accomplish this? I am not knowledgeable about VB at all. I
have tried using the Insert, Field and using an IF command but, ran
into a roadblock when it didn't seem to work and not sure what I'm
doing wrong.

Thanks for your help on this in advance.

--
S. Ross



  #5   Report Post  
Posted to microsoft.public.word.docmanagement
airhockeycanada airhockeycanada is offline
external usenet poster
 
Posts: 10
Default Form Fields

Honestly, I thought this would be a little easier. I appreciate the help but,
it is sounding like Greek to me. I have checked the Help topic on this and
it's not registering. This seems like a ton of work simply to have a field
place a rep's name in it based on a rep code selected in another field.
--
S. Ross


"Graham Mayor" wrote:

Suzanne has largely covered this, but the conditional field does not put the
information in another form field. To do that you will need to use vba. To
use conditional fields, they must go in the body of the document and the
calculate on exit check box property of the RepCode form field must be
checked. This will update the conditional fields but not if it is in the
header or footer. For those to update you will need to run a macro on exit
from the form field. I recommend also that you don't nest the fields but
concatenate them e.g.
{IF {REF State} = "CA" "For California residents, we offer special rates to
Asia and Japan."}{IF {REF State} = "WA" "For Washington residents, we offer
special rates to Asia and Japan."}etc

and

{IF {REF RepCode} = "100" "Dave Smith"}{IF {REF RepCode} = "101" "Sue
Worthy"}etc

then lock the form to allow the form fields to work.

If you want to run update code on exit from a field you'll find suitable
code at http://www.gmayor.com/installing_macro.htm

If you want to populate a form field (here shown as bookmark name RepName)
based on the content of a dropdown field (bookmark name RepCode) using vba
then you need something similar to the following, run on exit from the
dropdown field RepCode.

Sub OnExitRepCode()
'fills text form field based on content of a form field

Dim oFld As FormFields
Set oFld = ActiveDocument.FormFields
Select Case oFld("RepCode").Result
Case Is = "100"
oFld("RepName").Result = "Dave Smith"
Case Is = "101"
oFld("RepName").Result = "Sue Worthy"
Case Else
'Do nothing
End Select
End Sub


similarly the State version

Sub OnExitState()
Dim oFld As FormFields
Set oFld = ActiveDocument.FormFields
Select Case oFld("State").Result
Case Is = "CA"
oFld("Offer").Result = "For California residents, we offer special rates
to Asia and Japan."
Case Is = "WA"
oFld("Offer").Result = "For Washington residents, we offer special rates
to Asia and Japan."
Case Else
'Do nothing
End Select
End Sub

--

Graham Mayor - Word MVP

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




airhockeycanada wrote:
Well, I did try that and it didn't work. I know it's something I did
wrong but, not sure what. This is what the Help topic states to do
and I believe this is in the field where the rep's name would appear:

{IF {MERGEFIELD State} = "CA" "For California residents, we offer
special rates to Asia and Japan." "{IF {MERGEFIELD State} = "WA" "For
Washington residents, we offer special rates to Asia and Japan." " "}
"}

So, I did the following (by the way I have bookmarked my rep code
field RepCode):

{IF {MERGEFIELD RepCode} = "100" "Dave Smith" "{IF {MERGEFIELD
RepCode} = "101" "Sue Worthy" " "} "}

As an added problem, my RepCode bookmark seems not to be saving. When
I bring up the file again and check that the field is still
bookmarked as RepCode the bookmark is empty. Why is it not saving?

Finally, when adding an IF field the allowable space for the IF
string is not long enough for me to check for all our rep codes. Is
there a solution to this?

Thanks.



You'll need nested IF fields. See the "Specify multiple conditions"
portion of the Help topic "Examples of IF fields."

--
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.

"airhockeycanada" wrote in message
...
I am working with Microsoft Word 2002. I have a form created. One
of the fields is a drop-down list with 5 selections. These
selections are sales rep codes. We have another field which
displays the sales rep name. What I want to do is when a sales rep
code is selected from the drop-down list, I want the corresponding
sales rep name to appear in the sales rep name field.

How do I accomplish this? I am not knowledgeable about VB at all. I
have tried using the Insert, Field and using an IF command but, ran
into a roadblock when it didn't seem to work and not sure what I'm
doing wrong.

Thanks for your help on this in advance.

--
S. Ross






  #6   Report Post  
Posted to microsoft.public.word.docmanagement
Suzanne S. Barnhill Suzanne S. Barnhill is offline
external usenet poster
 
Posts: 33,624
Default Form Fields

It shouldn't be difficult provided you're putting the IF fields in text in
the body of the form; if I read Graham's answer correctly, it's only if
you're trying to put them in the header or footer (or another form field)
that it becomes complex (requiring macros).

I experimented with this, however, and found that, in this application, the
bookmark alone doesn't work: you do need a REF field as Graham suggests
(i.e., { REF RepCode } instead of just RepCode). Also, you have to tab out
of the dropdown field before the IF field will update. If you just select
something from the dropdown and don't tab (for example, if you select
another form field with the mouse), the "Calculate on exit" feature doesn't
work.

--
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.

"airhockeycanada" wrote in message
...
Honestly, I thought this would be a little easier. I appreciate the help

but,
it is sounding like Greek to me. I have checked the Help topic on this and
it's not registering. This seems like a ton of work simply to have a field
place a rep's name in it based on a rep code selected in another field.
--
S. Ross


"Graham Mayor" wrote:

Suzanne has largely covered this, but the conditional field does not put

the
information in another form field. To do that you will need to use vba.

To
use conditional fields, they must go in the body of the document and the
calculate on exit check box property of the RepCode form field must be
checked. This will update the conditional fields but not if it is in the
header or footer. For those to update you will need to run a macro on

exit
from the form field. I recommend also that you don't nest the fields but
concatenate them e.g.
{IF {REF State} = "CA" "For California residents, we offer special rates

to
Asia and Japan."}{IF {REF State} = "WA" "For Washington residents, we

offer
special rates to Asia and Japan."}etc

and

{IF {REF RepCode} = "100" "Dave Smith"}{IF {REF RepCode} = "101" "Sue
Worthy"}etc

then lock the form to allow the form fields to work.

If you want to run update code on exit from a field you'll find suitable
code at http://www.gmayor.com/installing_macro.htm

If you want to populate a form field (here shown as bookmark name

RepName)
based on the content of a dropdown field (bookmark name RepCode) using

vba
then you need something similar to the following, run on exit from the
dropdown field RepCode.

Sub OnExitRepCode()
'fills text form field based on content of a form field

Dim oFld As FormFields
Set oFld = ActiveDocument.FormFields
Select Case oFld("RepCode").Result
Case Is = "100"
oFld("RepName").Result = "Dave Smith"
Case Is = "101"
oFld("RepName").Result = "Sue Worthy"
Case Else
'Do nothing
End Select
End Sub


similarly the State version

Sub OnExitState()
Dim oFld As FormFields
Set oFld = ActiveDocument.FormFields
Select Case oFld("State").Result
Case Is = "CA"
oFld("Offer").Result = "For California residents, we offer special

rates
to Asia and Japan."
Case Is = "WA"
oFld("Offer").Result = "For Washington residents, we offer special

rates
to Asia and Japan."
Case Else
'Do nothing
End Select
End Sub

--

Graham Mayor - Word MVP

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




airhockeycanada wrote:
Well, I did try that and it didn't work. I know it's something I did
wrong but, not sure what. This is what the Help topic states to do
and I believe this is in the field where the rep's name would appear:

{IF {MERGEFIELD State} = "CA" "For California residents, we offer
special rates to Asia and Japan." "{IF {MERGEFIELD State} = "WA" "For
Washington residents, we offer special rates to Asia and Japan." " "}
"}

So, I did the following (by the way I have bookmarked my rep code
field RepCode):

{IF {MERGEFIELD RepCode} = "100" "Dave Smith" "{IF {MERGEFIELD
RepCode} = "101" "Sue Worthy" " "} "}

As an added problem, my RepCode bookmark seems not to be saving. When
I bring up the file again and check that the field is still
bookmarked as RepCode the bookmark is empty. Why is it not saving?

Finally, when adding an IF field the allowable space for the IF
string is not long enough for me to check for all our rep codes. Is
there a solution to this?

Thanks.



You'll need nested IF fields. See the "Specify multiple conditions"
portion of the Help topic "Examples of IF fields."

--
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.

"airhockeycanada" wrote in message
...
I am working with Microsoft Word 2002. I have a form created. One
of the fields is a drop-down list with 5 selections. These
selections are sales rep codes. We have another field which
displays the sales rep name. What I want to do is when a sales rep
code is selected from the drop-down list, I want the corresponding
sales rep name to appear in the sales rep name field.

How do I accomplish this? I am not knowledgeable about VB at all. I
have tried using the Insert, Field and using an IF command but, ran
into a roadblock when it didn't seem to work and not sure what I'm
doing wrong.

Thanks for your help on this in advance.

--
S. Ross





  #7   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Form Fields

You read correctly

--

Graham Mayor - Word MVP

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


Suzanne S. Barnhill wrote:
It shouldn't be difficult provided you're putting the IF fields in
text in the body of the form; if I read Graham's answer correctly,
it's only if you're trying to put them in the header or footer (or
another form field) that it becomes complex (requiring macros).

I experimented with this, however, and found that, in this
application, the bookmark alone doesn't work: you do need a REF field
as Graham suggests (i.e., { REF RepCode } instead of just RepCode).
Also, you have to tab out of the dropdown field before the IF field
will update. If you just select something from the dropdown and don't
tab (for example, if you select another form field with the mouse),
the "Calculate on exit" feature doesn't work.


"airhockeycanada" wrote in message
...
Honestly, I thought this would be a little easier. I appreciate the
help but, it is sounding like Greek to me. I have checked the Help
topic on this and it's not registering. This seems like a ton of
work simply to have a field place a rep's name in it based on a rep
code selected in another field. --
S. Ross


"Graham Mayor" wrote:

Suzanne has largely covered this, but the conditional field does
not put the information in another form field. To do that you will
need to use vba. To use conditional fields, they must go in the
body of the document and the calculate on exit check box property
of the RepCode form field must be checked. This will update the
conditional fields but not if it is in the header or footer. For
those to update you will need to run a macro on exit from the form
field. I recommend also that you don't nest the fields but
concatenate them e.g. {IF {REF State} = "CA" "For California
residents, we offer special rates to Asia and Japan."}{IF {REF
State} = "WA" "For Washington residents, we offer special rates to
Asia and Japan."}etc

and

{IF {REF RepCode} = "100" "Dave Smith"}{IF {REF RepCode} = "101"
"Sue Worthy"}etc

then lock the form to allow the form fields to work.

If you want to run update code on exit from a field you'll find
suitable code at http://www.gmayor.com/installing_macro.htm

If you want to populate a form field (here shown as bookmark name
RepName) based on the content of a dropdown field (bookmark name
RepCode) using vba then you need something similar to the
following, run on exit from the dropdown field RepCode.

Sub OnExitRepCode()
'fills text form field based on content of a form field

Dim oFld As FormFields
Set oFld = ActiveDocument.FormFields
Select Case oFld("RepCode").Result
Case Is = "100"
oFld("RepName").Result = "Dave Smith"
Case Is = "101"
oFld("RepName").Result = "Sue Worthy"
Case Else
'Do nothing
End Select
End Sub


similarly the State version

Sub OnExitState()
Dim oFld As FormFields
Set oFld = ActiveDocument.FormFields
Select Case oFld("State").Result
Case Is = "CA"
oFld("Offer").Result = "For California residents, we offer
special rates to Asia and Japan."
Case Is = "WA"
oFld("Offer").Result = "For Washington residents, we offer
special rates to Asia and Japan."
Case Else
'Do nothing
End Select
End Sub

--

Graham Mayor - Word MVP

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




airhockeycanada wrote:
Well, I did try that and it didn't work. I know it's something I
did wrong but, not sure what. This is what the Help topic states
to do and I believe this is in the field where the rep's name
would appear:

{IF {MERGEFIELD State} = "CA" "For California residents, we offer
special rates to Asia and Japan." "{IF {MERGEFIELD State} = "WA"
"For Washington residents, we offer special rates to Asia and
Japan." " "} "}

So, I did the following (by the way I have bookmarked my rep code
field RepCode):

{IF {MERGEFIELD RepCode} = "100" "Dave Smith" "{IF {MERGEFIELD
RepCode} = "101" "Sue Worthy" " "} "}

As an added problem, my RepCode bookmark seems not to be saving.
When I bring up the file again and check that the field is still
bookmarked as RepCode the bookmark is empty. Why is it not saving?

Finally, when adding an IF field the allowable space for the IF
string is not long enough for me to check for all our rep codes. Is
there a solution to this?

Thanks.



You'll need nested IF fields. See the "Specify multiple
conditions" portion of the Help topic "Examples of IF fields."

--
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.

"airhockeycanada" wrote in
message ...
I am working with Microsoft Word 2002. I have a form created. One
of the fields is a drop-down list with 5 selections. These
selections are sales rep codes. We have another field which
displays the sales rep name. What I want to do is when a sales
rep code is selected from the drop-down list, I want the
corresponding sales rep name to appear in the sales rep name
field.

How do I accomplish this? I am not knowledgeable about VB at
all. I have tried using the Insert, Field and using an IF
command but, ran into a roadblock when it didn't seem to work
and not sure what I'm doing wrong.

Thanks for your help on this in advance.

--
S. Ross



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
Auto fill Form Fields from previous Variable fields? OmaScott Microsoft Word Help 3 July 19th 06 09:09 PM
MS Word form fields versus mail merge fields [email protected] Mailmerge 4 March 4th 06 05:31 PM
Form fields versus mail merge fields [email protected] Microsoft Word Help 2 February 16th 06 02:12 PM
mail merge some fields leave other as form fields BethW Mailmerge 1 September 20th 05 06:47 PM
Controlling order of accessing form fields in a WORD form Tom Tables 1 January 6th 05 06:32 PM


All times are GMT +1. The time now is 08:07 AM.

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"