Hi Sal,
The numbers 10 and 7 were the hard coded examples of the specific info I was working with.
Order 10 at the time had been grouped with 9 and 8 (Manually) and I was trying to group them with order 7 which at the time had no grouped partners. What I would normally happen is that order 10 would group with order 7 and nothing else.
I would need all of 7's grouped partners to be included, and also all of order 10's grouped partners to now also group with 7.
Sounds confusingâ¦
The SQL I was using was broken up into two parts. (I'm no master of SQL yet). First I would group 10 and 7 to each other with the following statements.
In this example instead of 7 and 10 the current customer is mapped to customer ID.value and the person in a group being added is referenced as partner.
DoCmd.RunSQL "INSERT INTO BillWith (customerID, billWith)
values (" & customerID.Value & ", " & partner & ")"
DoCmd.RunSQL "INSERT INTO BillWith (customerID, billWith)
values (" & partner & ", " & customerID.Value & ")"
The INSERT INTO UNION query should go here to insert all combinations not already in the group
This would add the relationship and the inverse to the BillWith Table. Then using the union query, I would get all the active groups involved to join with each other as well. This would allow any person in the group to make an order in the future for the group and not depend on one contact person.
If I could do this all in one statement it would be interesting, or even if I could get the insert into union query working it would be very helpful.
The structures are:
BillWith is a table with no keys that acts as an M to N relationship.
long customerID
long billWith
Customer is our customer table
long customerID primary key Access autonumber field used.
and a ton of other fields which are irrelevant to this problem.
Basically I am trying to get a two column by n row subset of data and append that to the BillWith Table.
Thanks
-Roni
Roni Estein
[email protected]
https://www.e-drugsCanada.com