Populating fields in a form

G

Guest

I have a Customer Table where I store all customers info. I created Order
Form and on this form I set up a list box with customers last names. I would
like to select customer name from the list box and would like to
automatically populate all fields with customer info (address, phone, fax
number etc.) Thanks
 
A

Allen Browne

Greg, this is the wrong way to design a database.

You do not duplicate all the customer info in the Order form. By all means,
display them, but don't store them in the Order table as well as in the
Customer table.

A simple way to display them is to add extra columns to your list box. You
can even hide the columns (set them to zero-width), and then show them in
text boxes that refer to the columns of the list box, e.g.:
=[MyList].Column(2)
(Note that the first column is 0, so the 2nd one is 1, and so on.)

You should only duplicate fields if there is a good reason why they might be
different from the normal ones. For example, if you might need to cope with
an order that must be sent to a customer but not at their normal address,
then you do need the address fields for your orders. For an example of how
to set this up, open the Northwind sample database, open the Orders form,
and see the code in the AfterUpdate event procedure of the CustomerID combo.
 

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