Query base on Many-to-Many relationship
Posted on 2013-05-10
Customer Table: tblCustID(AutoN); tblCustFName(Text); tblCustLName(Text); tblCustLocal(Number)
frmCustomerInfo: tblCustID; tblCustFName; tblCustLName; these are text boxes
tblCusLocal(ComboBox) Properties: SELECT tblLocal.tblLocalID, tblLocal.tblLocalName, tblOrganization.tblOrganizationName FROM tblLocal INNER JOIN tblOrganization ON tblLocal.tblLocalID=tblOrganization.[tblOrganizationLocal];
frmOrders: tblOrdersDate(Date) TextBox; tblOrdersSeason(text) ComboBox; tblOrdersID(Auto)TextBox; tblOrdersCustID(text)ComboBox... There is a subForm that contain products purchased.
Here's my problem - when I run the query do display the orders sorted by customer and organization I get duplicate records for each customer cause each location has multiple organizations and to get from the tblcustomer to the tblorganization, I have to go through the tbllocal
(one-to-many betwn tblcustomer and tblorganization where tbllocal is the one in both relationships).
The results give me locals plus all the organization that that local has associated with it for each customer, but if you examine the above info in up top, U can C that, when I enter the customer info in the frmCustomer, I pick a specific local/organization combination. I know I'm leaving out some info, but I figure this is a good way to start.