
Originally Posted by
matey56
I think I'm getting close. Now, when I change the location it changes it for all records in the DB. How do I make it so it's only changing it for the current record?
You should not be storing the code as well as the location in a referencing table, only in the referenced table from which you are selecting a location by means of a combo box. If you were to store the code in the referencing table it would not be functionally determined solely by the primary key of the table, but transitively determined via the location column. The table would thus not be normalized to Third Normal For (3NF) and open to the risk of update anomalies.
There are a number of ways in which the code can be shown in the form when you select a location. One way is to return the code in a column in the combo box's RowSource query. The following is an example:
Code:
SELECT Contacts.ContactID, [LastName] & ", " & [FirstName] AS Customer,
Contacts.Address, Cities.City, Regions.Region, Countries.Country
FROM Countries INNER JOIN (Regions INNER JOIN (Cities INNER JOIN Contacts
ON Cities.CityID = Contacts.CityID)
ON Regions.RegionID = Cities.RegionID)
ON Countries.CountryID = Regions.CountryID
ORDER BY Contacts.LastName, Contacts.FirstName;
The combo box will show the selected contact by name. Additional text box controls will show the contact's address data by setting their ControlSource properties as follows:
=[cboCustomer].[Column](2)
=[cboCustomer].[Column](3)
=[cboCustomer].[Column](4)
=[cboCustomer].[Column](4)
Note that the Column property is zero-based, so Column(2) is the third column, and so on.