Mapping based on the drop down selection

  • Thread starter Thread starter ah
  • Start date Start date
A

ah

Hi;

I have a drop down list for the user to select the "country" in my form now.
Appreciate if someone could advice me on how to get the following done:

a) The word "Passport" to be appeared automatically in 1 of the coumn in my
table when I select a country called "Singapore"
b) The word "Health Plan" to be appered in the same column when I select a
country called "UK"

As a result of that, different wording needs to be appered automatically
when I select different country and etc

Please advice.
Thanks
 
You would have to run a macro on exit from the dropdown form field and you
would need text form field(s) where you want to display the information eg

Sub OnExitDD1()
'fills text field based on content of _
dropdown field

Dim oFld As FormFields
Set oFld = ActiveDocument.FormFields
Select Case oFld("Dropdown1").Result
Case Is = "Singapore"
oFld("Text1").Result = "Passport"
Case Is = "UK"
oFld("Text1").Result = "Health Plan"
Case Else
'Do nothing
End Select
End Sub


Create a statement for each entry in your list
eg

Case Is = "Singapore"
oFld("Text1").Result = "Passport"

http://www.gmayor.com/installing_macro.htm

Note that a dropdown field will only hold 25 entries. If you need more then
you would have to consider instead the use of listboxes in userforms
Word MVP FAQ - Userforms http://word.mvps.org/FAQs/Userforms.htm

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
Hi;

Thanks for your help. It managed to display the default wording based on
the country that I select now. However, it allows the users to change and
overwrite the default value as it is a text field.

I understand that I could untick the "fill in enabled" option to block this,
but there are some contries that I want the user to key in their value
manually into the same field.

Please advice whether I could add the "Fill in enabled" coding into the
macro to allow the user to overwrite the default value when they select a
country called "Singapore", and disallow them from overwrite the value when
they select a country called "UK".

Please advice.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top