PC Review


Reply
Thread Tools Rate Thread

auto-fill the next 3 fields when selecting text from a dropdown

 
 
=?Utf-8?B?RnJlZGRpZSBGcmVkcmlja3M=?=
Guest
Posts: n/a
 
      24th Sep 2007
I currently have 4 dropdown fields on a form: Name - Position - Ext. Email.
I want the Position - Ext. & Email fields to auto-fill with the correct info,
when a name is selected. Note: Each name has unique data for each field. I
am ignorant when it comes to macros, so I need to have my hand held through
this one. Thanks.
 
Reply With Quote
 
 
 
 
Suzanne S. Barnhill
Guest
Posts: n/a
 
      24th Sep 2007
You may not need a macro; this can be done with IF fields, though it can get
pretty messy if there are a lot of names. How many names are there? Provide
some sample names and positions, and I'll provide some sample 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.

"Freddie Fredricks" <Freddie (E-Mail Removed)> wrote in
message news:BD37CAE6-B2FF-412B-8082-(E-Mail Removed)...
> I currently have 4 dropdown fields on a form: Name - Position - Ext.

Email.
> I want the Position - Ext. & Email fields to auto-fill with the correct

info,
> when a name is selected. Note: Each name has unique data for each field.

I
> am ignorant when it comes to macros, so I need to have my hand held

through
> this one. Thanks.


 
Reply With Quote
 
Graham Mayor
Guest
Posts: n/a
 
      24th Sep 2007
Essentially you would run a macro on exit from the dropdown field which
would populate the other fields 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 = "Bob"
oFld("Text1").Result = "867-5309"
oFld("Text2").Result= (E-Mail Removed)
Case Is = "Joe"
oFld("Text1").Result = "911-1111"
oFld("Text2").Result = (E-Mail Removed)
Case Else
'Do nothing
End Select
End Sub

You need a case statement and a set of results for each entry in the
dropdown (which here is bookmarked dropdown1 and fills fields text1 and
text2)

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


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

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

Freddie Fredricks wrote:
> I currently have 4 dropdown fields on a form: Name - Position - Ext.
> Email.
> I want the Position - Ext. & Email fields to auto-fill with the
> correct info, when a name is selected. Note: Each name has unique
> data for each field. I am ignorant when it comes to macros, so I
> need to have my hand held through this one. Thanks.



 
Reply With Quote
 
=?Utf-8?B?RnJlZGRpZSBGcmVkcmlja3M=?=
Guest
Posts: n/a
 
      24th Sep 2007
I currently have 3 names - 3 postions - 3 Exts & 3 emails (each email is
identical after @...... sample:

[NAME] [POSITION] [EXT] [EMAIL]
@abc.com
Willie Smith DIR 111 wsmith
John Jones AD Ops 112 jjones
Gail Storms AD Sales 120 gstorms

Appreciate any help



"Suzanne S. Barnhill" wrote:

> You may not need a macro; this can be done with IF fields, though it can get
> pretty messy if there are a lot of names. How many names are there? Provide
> some sample names and positions, and I'll provide some sample 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.
>
> "Freddie Fredricks" <Freddie (E-Mail Removed)> wrote in
> message news:BD37CAE6-B2FF-412B-8082-(E-Mail Removed)...
> > I currently have 4 dropdown fields on a form: Name - Position - Ext.

> Email.
> > I want the Position - Ext. & Email fields to auto-fill with the correct

> info,
> > when a name is selected. Note: Each name has unique data for each field.

> I
> > am ignorant when it comes to macros, so I need to have my hand held

> through
> > this one. Thanks.

>
>

 
Reply With Quote
 
Suzanne S. Barnhill
Guest
Posts: n/a
 
      24th Sep 2007
Use a dropdown form field for the name, and make sure that the bookmark of
this field (in the Form Field Options) is Name. Then, instead of inserting a
form field for Position, Ext, or Email, use fields such as the following:

For Position:

{ IF { REF Name } = "Willie Smith" "DIR" }{ IF { REF Name} = "John Jones"
"AD Ops" }{ IF { REF Name } = "Gail Storms" "AD Sales" }

For Ext:

{ IF { REF Name } = "Willie Smith" "111" }{ IF { REF Name} = "John Jones"
"112" }{ IF { REF Name } = "Gail Storms" "120" }

For Email:

{ IF { REF Name } = "Willie Smith" "wsmith" }{ IF { REF Name} = "John Jones"
"jjones" }{ IF { REF Name } = "Gail Storms" "gstorms" }@abc.com

Each pair of field delimiters (the things that look like braces but can't be
entered from the keyboard) must be inserted using Ctrl+F9. Note that
"Calculate on exit" must be checked in the Form Field Options for your Name
field, and that users must Tab out of the field (not just click the mouse
elsewhere) for the IF fields to be updated.

In this situation, you may find Graham's macro more practical.

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

"Freddie Fredricks" <(E-Mail Removed)> wrote in
message news:9C8272BF-8DF4-470D-A9FA-(E-Mail Removed)...
> I currently have 3 names - 3 postions - 3 Exts & 3 emails (each email is
> identical after @...... sample:
>
> [NAME] [POSITION] [EXT] [EMAIL]
> @abc.com
> Willie Smith DIR 111

wsmith
> John Jones AD Ops 112 jjones
> Gail Storms AD Sales 120 gstorms
>
> Appreciate any help
>
>
>
> "Suzanne S. Barnhill" wrote:
>
> > You may not need a macro; this can be done with IF fields, though it can

get
> > pretty messy if there are a lot of names. How many names are there?

Provide
> > some sample names and positions, and I'll provide some sample 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.
> >
> > "Freddie Fredricks" <Freddie (E-Mail Removed)> wrote

in
> > message news:BD37CAE6-B2FF-412B-8082-(E-Mail Removed)...
> > > I currently have 4 dropdown fields on a form: Name - Position - Ext.

> > Email.
> > > I want the Position - Ext. & Email fields to auto-fill with the

correct
> > info,
> > > when a name is selected. Note: Each name has unique data for each

field.
> > I
> > > am ignorant when it comes to macros, so I need to have my hand held

> > through
> > > this one. Thanks.

> >
> >


 
Reply With Quote
 
Graham Mayor
Guest
Posts: n/a
 
      25th Sep 2007
If you prefer the macro solution, then the macro I posted earlier using your
further information would be

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

Dim oFld As FormFields
Set oFld = ActiveDocument.FormFields
Select Case oFld("NAME").Result

Case Is = "Willie Smith"
oFld("POSITION").Result = "DIR"
oFld("EXT").Result = "111"
oFld("EMAIL").Result = "wsmith"

Case Is = "John Jones"
oFld("POSITION").Result = "Ad Ops"
oFld("EXT").Result = "112"
oFld("EMAIL").Result = "jjones"

Case Is = "Gail Storms"
oFld("POSITION").Result = "AdSales"
oFld("EXT").Result = "120"
oFld("EMAIL").Result = "gstorms"

Case Else
'Do nothing
End Select
End Sub

Set the bookmark name of the dropdown field to NAME
the bookmark name of the position field to POSITION
the bookmark name of the extension field to EXT
and the bookmark name of the email field to EMAIL

(right click the fields > properties)

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

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

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


Freddie Fredricks wrote:
> I currently have 3 names - 3 postions - 3 Exts & 3 emails (each email
> is identical after @...... sample:
>
> [NAME] [POSITION] [EXT]
> [EMAIL] @abc.com
> Willie Smith DIR 111
> wsmith John Jones AD Ops 112
> jjones Gail Storms AD Sales 120
> gstorms
>
> Appreciate any help
>
>
>
> "Suzanne S. Barnhill" wrote:
>
>> You may not need a macro; this can be done with IF fields, though it
>> can get pretty messy if there are a lot of names. How many names are
>> there? Provide some sample names and positions, and I'll provide
>> some sample 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.
>>
>> "Freddie Fredricks" <Freddie (E-Mail Removed)>
>> wrote in message
>> news:BD37CAE6-B2FF-412B-8082-(E-Mail Removed)...
>>> I currently have 4 dropdown fields on a form: Name - Position -
>>> Ext. Email. I want the Position - Ext. & Email fields to auto-fill
>>> with the correct info, when a name is selected. Note: Each name
>>> has unique data for each field. I am ignorant when it comes to
>>> macros, so I need to have my hand held through this one. Thanks.



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
RE: DropDown aand Auto Fill Pritesh Microsoft Excel Misc 0 30th Mar 2010 03:28 PM
fill in other fields from a dropdown list Michael Microsoft Access Forms 2 14th Jun 2005 02:44 PM
Re: Auto fill fields of a table when selecting a combo box option John Vinson Microsoft Access 1 8th Sep 2004 10:59 PM
Re: Auto fill fields of a table when selecting a combo box option '69 Camaro Microsoft Access 0 7th Sep 2004 09:56 PM
Re: Auto fill fields of a table when selecting a combo box option M Skabialka Microsoft Access 0 7th Sep 2004 09:53 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:03 PM.