Group: microsoft.public.word.vba.general
From: hermithead
Date: Thursday, February 28, 2008 8:55 PM
Subject: Re: Linked drop down fields - auto populate second field

On Feb 28, 2:29=A0pm, "Doug Robbins - Word MVP"
wrote:
> You do not use a second DropDown FormField, but you do have a Text FormFie=
ld
> and my code assumes that the bookmark name "Address" has been assigned to
> that FormField.and it assumes that the name of the bookmark assigned to th=
e
> DropDown FormField is "name"
>
> You only have the code once (exactly as I posted it) and you set it to be
> run On Exit from the DropDown FormField.
>
> --
> Hope this helps.
>
> Please reply to the newsgroup unless you wish to avail yourself of my
> services on a paid consulting basis.
>
> Doug Robbins - Word MVP
>
> "hermithead" wrote in message
>

> On Feb 27, 6:20 pm, "Doug Robbins - Word MVP"
>
>
>
> wrote:
> > If you have the addresses stored as autotext entries in the template YES=

> > with the "name" of the autotext entry being the name as listed in the
> > DropDown
> > FormFields, the following code run on exit from the DropDown Formfield
>
> > ' Macro created 15-11-97 by Doug Robbins to add the address correspondin=
g
> > to
> > a drop down name
>
> > Dim myDrop As DropDown
> > Dim myName As String
> > Set myDrop =3D ActiveDocument.FormFields("Name").DropDown
> > myName =3D myDrop.ListEntries(myDrop.Value).Name
> > Address =3D ActiveDocument.AttachedTemplate.AutoTextEntries(myName).Valu=
e
> > ActiveDocument.FormFields("Address").Result =3D Address
>
> > --
> > Hope this helps.
>
> > Please reply to the newsgroup unless you wish to avail yourself of my
> > services on a paid consulting basis.
>
> > Doug Robbins - Word MVP
>
> > "hermithead" wrote in message
>
> >news:caa426b4-5772-4d48-b144-fb9802fce99b@n75g2000hsh.googlegroups.com...=

>
> > > Hi, This macro works fine
> > >http://gregmaxey.mvps.org/Linked_DropDown_Fields.htm
> > > however is it possible to modify this so the second field Auto
> > > Populates based on the selection of the first drop down box?
> > > At present the user has to manually click in the second field and
> > > select from a list. In my case my list only needs to contain one
> > > choice. Eg. My first drop down list includes a list of names: John
> > > Smith, Bob Smith, Fred Smith which correspond to each of their own
> > > postal addresses. So If I select Bob Smith then the second field
> > > should auto populate with his address and so forth. This doesnt happen=

> > > in the macro above can anyone suggest how this second field can be
> > > auto populated. Thanks.- Hide quoted text -
>
> > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -

It's now working - Thank you. However I was hoping the Text Form Field
would auto populate without the user having to click into this field.
Just want it so the user selects a name from the drop down and then an
address automatically appears in the Text form. Without the user
having to click in the Text Form at all. At the moment it is prone to
user error - the user could select the name but neglect to click in
the Text Form which triggers the change of address. In html I think
its called a cascading dropdown. This site explains it
http://www.asp.net/AJAX/AjaxControlToolkit/Samples/CascadingDropDown/Cascadi=
ngDropDown.aspx
Thanks again