I am having trouble with a join I need to do - Here's what the problem is: I have a database of 17 salespeople, each salesperson has his own totals such as expenses and advances and commissions. In my database there are about 200 customers that can have up to 3 salespeople on them. That is the minority but it does exist. Each salesperson is paid on invoices for that account. Some of my salespeople are only the 2nd salesperson on an account, meaning they are never the 1st, so if I do a join of a salesperson to invoices - he doesn't have any invoices because he is never salesman 1. I can pull invoices for him as salesman 2 when I am only looking at invoices, but every 8 weeks I need to join his expenses where he is salesman 1 to his invoices where he is salesman 2. I cannot get it to work or come up with a solution. I have a salesperson query so every 8 weeks I can call salesman number 100 to see his expenses I have a invoices/payments query and see what he has in for payments - but my 3rd query where I am trying to bring the salesman together with his payments doesn't work because he is the 1st salesman in expenses and the 2nd salesman in the invoices/payments I have tried every which way in SQL and can't seem to get it right.
Is there a way I can join the salesman1 from the salesman query to the invoices/payments query on slmn1 or slmn2 or slmn3?
this example is too complex:
FROM qryFinalWeek
INNER JOIN QryFW ON qryFinalWeek.SLMN = QryFW.SLMN2 OR QryFW.SLMN3 OR QryFW.Salesrep1
WHERE (((QryFW.PDATE)=[FDATE]+4));
this example is only giving invoices where he's first salesman so i can't get any commissions if he is the second:
WHERE (((qryFinalWeek.SLMN)=[Forms]![frFWDATE]![Text0]) AND ((QryFW.PDATE)=[FDATE]+4)) OR (((QryFW.SLMN2)=[Forms]![frFWDATE]![Text0]) AND ((QryFW.PDATE)=[FDATE]+4)) OR (((QryFW.SLMN3)=[Forms]![frFWDATE]![Text0]) AND ((QryFW.PDATE)=[FDATE]+4))
any feedback is appreciated!