Changing textbox based on other data

miscnine

New member
Local time
Today, 04:59
Joined
Jun 14, 2002
Messages
9
I would like to update textboxes in a form based on what is chosen by a combobox. The data all comes from the same query, but I do not know how to set the textbox to update to the data I want. Here is my example:

---
I have a query with Customer Name, Company Name, Date Created, & Image Location.

In my form, I have a combobox for Customer Name. When I choose CustomerX from this box, I would like the Company Name, Date Created & Image Location all to update with the data form the query (I want to be able to store this information in the same table for a report I am using). However, the Image Location field needs to be able to be changed by the user they want to use a different image.

Any help is aprreicated.

miscnine@hotmail.com
 
Not sure I quite understand. Do you have the Customer info in another table and you are trying to save the same data to a different table or are you just trying to view the customer information when you select their details from the combo box?

If you just want to view the information, in the query for the form add the customer info table and link it by the PK to the table that the form is based on. Add the fields from the customer table that you want to view, address, telephone number, whatever. Make sure that the combo box is bound to the Customer field in the second table and then, when you select a customer from the combo box, their details will appear in the appropriate fields.

I hope that helps but if not, shout.
 
Thank you for your reply, but I don't follow. What I have is a table called "Customer" that has the following data: Customer name, Company name, Date Created & Image Location. I have another table called "Projects" that has the project name and information. I have a form where users can add projects by typing in its information; However, I do not want them to have to retype the information from the "Customer" table. So when they select CustomerX from the combo box, the fields fill in with the related data to that customer (company name, date created, & image location). This way, I can run a report on the "Projects" table, and the same information for the customer pulls up for each project. I hope that gives you a better idea of what I am trying to do. Thank you for your help.
 
I take it a project is done on behalf or includes a customer so for each project you would specify a customer. You should have a customer id field in the projects table and link it one customer to many projects.

Creat a query that has both tables. Take all the fields from the projects table and the customer address fields, etc from the customer table.

Create your combo box using the wizard and look up the customer name from the customer table. Take the customer primary key field (hopefully an autonumber!) as well but you can hide it. That should be bound to the customer id field in the projects table.

When you select a customer from the combo box, their related details should automatically fill in to the fields on the form.

Hope that's a bit clearer.
 
Don't forget to remove the extraneous Customer fields (except CustomerID) from the Projects table.

Do a little reading on relational databases to understand why storing a duplicate copy of the customer information in the projects table is poor practice and leads to update anomolies.
 
Thank you

After reading all of your replies, and staying up way too late last night, I was able to acomplish what I wanted. Thank you for all your help.

miscnine@hotmail.com
 

Users who are viewing this thread

Back
Top Bottom