Auto Fill Query Fields

ckirmser

Registered User.
Local time
Today, 04:17
Joined
Oct 1, 2004
Messages
41
I've been beating myself silly trying to figure this out on my own, but it's just not happening.

I'm creating a database form that will store company address information. It has a combobox control whose list parameter is loaded by the contents of a query so that, if a company is selected that has already been entered, it will auto-complete the name.

Then, there are fields for the company address, city, state, zip, phone number, contact info, etc. But, it is tedious to fill in these things e-v-e-r-y--s-i-n-g-l-e--t-i-m-e.

I have created a set of queries that individually pull the related data - address, city, state, etc. - using the text field of the combobox as the criteria (two fields in each query; the company name and the required data with the company name field not displayed).

So, I've been trying to create an Exit event for the company name combobox that will run a VBasic procedure that calls each query and populates each field in the form accordingly.

It just ain't a-workin'.

Any ideas on how I can get address and contact fields in a form to auto-populate once the company is selected from a combobox?
 
First question is...if the company already exists, why are you creating a duplicate record? If you need to record the company data with another record, you should be storing the Primary Key for that company with the record. This is called a One to Many Relationship.
 
First question is...if the company already exists, why are you creating a duplicate record? If you need to record the company data with another record, you should be storing the Primary Key for that company with the record. This is called a One to Many Relationship.

Hmm.

Well, what I'm doing is just slapping together a little contact log from which I can pull up contacts made during certain periods for a report. A report that I haven't tackled, yet.

What I've got is a single table that has a record for each contact and its details and I may make more than one contact for each company. There's not so much a duplicate entry for the company, as each record is unique as a whole, but company data may be duplicated in several records.
 
Hmm.

Well, what I'm doing is just slapping together a little contact log from which I can pull up contacts made during certain periods for a report. A report that I haven't tackled, yet.

What I've got is a single table that has a record for each contact and its details and I may make more than one contact for each company. There's not so much a duplicate entry for the company, as each record is unique as a whole, but company data may be duplicated in several records.

What you are describing is a One to Many Relationship, and there should be at least 2 tables. One to hold the Company Information and one to hold the Contact information. You should store the CompanyID with each contact record so that you dont have to duplicate the data.
 

Users who are viewing this thread

Back
Top Bottom