forms : auto-complete fields based on another field's entry

E

ericm

I searched under the words "macro" and "if" but I did not find what I want,
and I think what I need is a macro for the multiple "if/then" statements.

What I want to do is this : When an entry is made into one field, I want the
other fields to auto-fill based on the first field's entry. For example,
there are six branch locations of an office numbered one through six. Each
branch has a seperate address, phone number, fax number, etc... On the form
there are fields for branch number, address, phone, fax, etc... If "1" is
entered in the branch number field meaning branch number one, then the fields
for address, phone, fax, etc. will auto-fill with the address, name, fax etc
for branch number one. The information will be different for branch 2 and so
on.

Thank you.
 
M

macropod

Hi ericm,

Doing this requires a fairly straight-forward field construction using and IF test for each branch. For example, suppose your
formfield's bookmark name is 'Branch' and the formfield is set to 'calculate on exit', then the following could be used:
{IF{=Branch}= 1 "Branch1 Name¶Branch1 address line 1¶Branch1 address line 2¶Branch1 address line 3¶Branch1 phone¶Branch1 fax"}
{IF{=Branch}= 2 "Branch2 Name¶Branch2 address line 1¶Branch2 address line 2¶Branch2 address line 3¶Branch2 phone¶Branch2 fax"}
etc.

If you don't want all the data showing in the same field result, you could split the fields into two or more parts, eg:
{IF{=Branch}= 1 "Branch1 Name¶Branch1 address line 1¶Branch1 address line 2¶Branch1 address line 3"}
in one location, and
{IF{=Branch}= 1 "Branch1 phone¶Branch1 fax"}
in another location.

Replace the pilcrows (ie ¶) in the above with proper carriage returns or line feeds.

Cheers
 
E

ericm

correction : I think I found an answer under 'auto-fill the next 3 fields...'
post, dated 09/27/07.
 
E

ericm

Thanks. I like your response better cause I'm not sure all computers in the
network have macros set to "on".

macropod said:
Hi ericm,

Doing this requires a fairly straight-forward field construction using and IF test for each branch. For example, suppose your
formfield's bookmark name is 'Branch' and the formfield is set to 'calculate on exit', then the following could be used:
{IF{=Branch}= 1 "Branch1 Name¶Branch1 address line 1¶Branch1 address line 2¶Branch1 address line 3¶Branch1 phone¶Branch1 fax"}
{IF{=Branch}= 2 "Branch2 Name¶Branch2 address line 1¶Branch2 address line 2¶Branch2 address line 3¶Branch2 phone¶Branch2 fax"}
etc.

If you don't want all the data showing in the same field result, you could split the fields into two or more parts, eg:
{IF{=Branch}= 1 "Branch1 Name¶Branch1 address line 1¶Branch1 address line 2¶Branch1 address line 3"}
in one location, and
{IF{=Branch}= 1 "Branch1 phone¶Branch1 fax"}
in another location.

Replace the pilcrows (ie ¶) in the above with proper carriage returns or line feeds.

Cheers
--
macropod
[MVP - Microsoft Word]
-------------------------

ericm said:
I searched under the words "macro" and "if" but I did not find what I want,
and I think what I need is a macro for the multiple "if/then" statements.

What I want to do is this : When an entry is made into one field, I want the
other fields to auto-fill based on the first field's entry. For example,
there are six branch locations of an office numbered one through six. Each
branch has a seperate address, phone number, fax number, etc... On the form
there are fields for branch number, address, phone, fax, etc... If "1" is
entered in the branch number field meaning branch number one, then the fields
for address, phone, fax, etc. will auto-fill with the address, name, fax etc
for branch number one. The information will be different for branch 2 and so
on.

Thank you.
 

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

Top