filling form fields with information that may or may not be the sa

A

amjjam

Hi,

I have 2 forms (each with an underlying table): contacts and companies. One
company can have many contacts associated with it. The contacts form asks for
the contact's business address. If that address is the only one the company
has, I'd like for it to automatically fill in the company's address in the
company form. If, however, the company has a different main address, I'd like
to be able to store it in the company form (and retain the contact's distinct
address too). (For example, a contact may work at an outpatient clinic at a
site which is different from the main hospital that runs it; or a professor's
mailing address may be different from the main campus address.) I don't
believe I can make the companies form a subform of the contacts form because
I won't always have a contact name when I know the company's information. So
I won't always have a ContactID to associate with a Company ID. Is there a
way to gather the address information without having to retype it if it's
repetitive? Thanks for any help.
 
M

Maarkr

I would show it as a subform... make sure referential integrity is NOT
checked so it will not force you to have a record in the sub for each record
in the main.
 
A

amjjam

Okay, that makes sense. How do I get the address to fill itself in in the
subform if it's the same and to leave blanks if it's different? I'm a novice
at Access, so I need pretty explicit steps. Thanks.
 
A

amjjam

Perfect! Thanks, Steve! I had the main form based on the contact and the
subform based on the company, so my logic was completely reversed. With your
information, I can handle the reversal, and it should all work.
 
A

amjjam

Hi,

Your advice works great for most fields. I've tried to include a combo box
for the state name abbreviation. While it fills in perfectly in the company
form, it doesn't accept the on click fill in if it's the same in the contacts
form. Is there a way to leave a combo box in both the company and contact
forms and have it either fill-in on click if the state name abbreviation is
the same in the contact form as it is for the company or use it to fill in
the contact's state if that goes with a new address? Should I just remove the
combo box and go back to a regular text box? Thanks.
 
T

tankhaf mohamed

amjjam said:
Hi,

Your advice works great for most fields. I've tried to include a combo box
for the state name abbreviation. While it fills in perfectly in the
company
form, it doesn't accept the on click fill in if it's the same in the
contacts
form. Is there a way to leave a combo box in both the company and contact
forms and have it either fill-in on click if the state name abbreviation
is
the same in the contact form as it is for the company or use it to fill in
the contact's state if that goes with a new address? Should I just remove
the
combo box and go back to a regular text box? Thanks.
 

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