Steve
I am a little puzzled...
In the table design we want the dropdown for the addressID to be limited to the addresses matching the Employees CompanyID
Is this your objective?
Then you state...
Using the form was not the problem, it was how to do it at the table design level, it can't be done, we've used forms.
If you are stating that you can not use a table design to accomplish your objective, I beg to differ.
Here is a scenario...
International Company A has addresses around the world.
They outsource their IT to Company B and C. Focusing on Company B, Company B would have some addresses that co-exist with Company A plus other addresses used for other companies they support plus their corporate and regional addresses.
You can achieve this several ways. The design I presented achieves this with the CompanyCode and SiteCode assigned to an employee.
Who works at this specific site?
Query all employees matching the SiteCode regardless of company.
Who works at for Company A at this specific site?
Query for a match on Company A and the SiteCode.
Where do all employees at Company A work?
Query for SiteCodes for a match on the CompanyCode.
In fact this answers your post ...
YouSaid said:
In the table design we want the dropdown for the addressID to be limited to the addresses matching the Employees CompanyID
Note that once you have the site code, you have the address.
On the SiteTbl, I include the CompanyCode. I forgot to mention that this would refernce who "owns" the site, and does not restrict the site to one specific company.
By changing the RowSource "on the fly" for the Address combo box, the combo box will depict only addresses where the Company has addresses. (My bad for not mentioning this the first time around)
Did I miss something?
...Moving on to the
Table Design.
You can setup the LookUp at the table level. The issues are...
- That the combo box is loaded when the form is loaded. You have to reload the record set assigned to the combo box each time the company code changes. You have to do this at the form level...
Code:
Me.cboSiteCode.RowSource = strSQL
Me.cboSiteCode.Requery
- Next, you can not / should not use a parameter query (where Access looks for a specific site codes to match a company code - is this what you want to do?) in the LookUp field. Any time the site code field was referenced, it would have to know what the CompanyCode is, and where specifically to go and get the CompanyCode. It is oner thing to force integrity and restrict CompanyCodes and SiteCodes to their respective table and field; it is quite another to drill down to the record level.
I appreciate the convenience of setting up LookUps at the table level - sure fascilatates the creation of the forms. However, I invite you to read (perhaps you already have) the
Ten Commandments of Access by Dev Ashish and Arvin Meyer...
Good luck on your project.