Hi.
I have an Access2000 database that tracks Broker commissions. For example, BrokerA had sales (and commissions) for Ins. CompanyA, Ins. CompanyB and Ins. CompanyC this month. BrokerB had sales (and commissions) for Ins. CompanyA and Ins. CompanyD this month. BrokerC had no sales (or commissions) this month (and is on the verge of being fired!).
I created a crosstab query (and a subsequent report) that's supposed to list ALL brokers, whether they had sales or not, as the "row", and all the Ins. Companies we do business with as the "columns". So for each Broker, the total commissions are listed for each company he/she had sales for. It looks like this:
COMMISSIONS ON SALES
OCTOBER 2003
CompanyA CompanyB CompanyC CompanyD Etc
BrokerA $200.00 $75.00 $40.00
BrokerB $80.00 $100.00
BrokerC
BrokerD
Etc
Ect
There will be totals for both rows and columns as well, but that's not the problem (yet).
What's happening is that ONLY those brokers who had sales (and commissions) for the given month (in this case, October 2003), is listed. I need ALL brokers to be listed. I understand why the ones without sales (commissions) are not listed as I have a table (<tblBrokerMonthlyData>)that saves all transactions data. If a broker has no sales that month then he/she won't be in the table (obviously) The broker info (Name, address, etc) is in a separate table (<tblBrokerInfo>).
I tried to set the query JOIN property to type 2, (Include ALL records from <tblBrokerInfo> and only those records from <tblBrokerMonthlyData> where the joined fields are equal.), but get the following message:
"The SQL statement could not be executed because it contains ambiguous OUTER joins. To force one of the joins to be performed first, create a separate query that performs the first join and then include that query in your SQL statement."
I've been trying to do what was suggested but can't seem to get it to work. My SQL statement for the query is as follows:
TRANSFORM Sum(tblBrokerMonthlyData.BrokerFYC) AS SumOfBrokerFYC
SELECT ([BrkrLN] & " " & [BrkrFN] & [BrkrCompanyName]) AS LNFN, ([BrkrORRatea] & "/" & [BrkrORRateIA]) AS BrokerORRates
FROM tblCompanyInfo INNER JOIN (tblBrokerInfo LEFT JOIN tblBrokerMonthlyData ON tblBrokerInfo.BrkrID = tblBrokerMonthlyData.BrokerID) ON tblCompanyInfo.CmpnyID = tblBrokerMonthlyData.CompanyID
GROUP BY ([BrkrLN] & " " & [BrkrFN] & [BrkrCompanyName]), ([BrkrORRatea] & "/" & [BrkrORRateIA])
PIVOT tblCompanyInfo.CmpnyName;
Could anyone take a look and point me in the right direction?
Many TIAs!
Mark
I have an Access2000 database that tracks Broker commissions. For example, BrokerA had sales (and commissions) for Ins. CompanyA, Ins. CompanyB and Ins. CompanyC this month. BrokerB had sales (and commissions) for Ins. CompanyA and Ins. CompanyD this month. BrokerC had no sales (or commissions) this month (and is on the verge of being fired!).
I created a crosstab query (and a subsequent report) that's supposed to list ALL brokers, whether they had sales or not, as the "row", and all the Ins. Companies we do business with as the "columns". So for each Broker, the total commissions are listed for each company he/she had sales for. It looks like this:
COMMISSIONS ON SALES
OCTOBER 2003
CompanyA CompanyB CompanyC CompanyD Etc
BrokerA $200.00 $75.00 $40.00
BrokerB $80.00 $100.00
BrokerC
BrokerD
Etc
Ect
There will be totals for both rows and columns as well, but that's not the problem (yet).
What's happening is that ONLY those brokers who had sales (and commissions) for the given month (in this case, October 2003), is listed. I need ALL brokers to be listed. I understand why the ones without sales (commissions) are not listed as I have a table (<tblBrokerMonthlyData>)that saves all transactions data. If a broker has no sales that month then he/she won't be in the table (obviously) The broker info (Name, address, etc) is in a separate table (<tblBrokerInfo>).
I tried to set the query JOIN property to type 2, (Include ALL records from <tblBrokerInfo> and only those records from <tblBrokerMonthlyData> where the joined fields are equal.), but get the following message:
"The SQL statement could not be executed because it contains ambiguous OUTER joins. To force one of the joins to be performed first, create a separate query that performs the first join and then include that query in your SQL statement."
I've been trying to do what was suggested but can't seem to get it to work. My SQL statement for the query is as follows:
TRANSFORM Sum(tblBrokerMonthlyData.BrokerFYC) AS SumOfBrokerFYC
SELECT ([BrkrLN] & " " & [BrkrFN] & [BrkrCompanyName]) AS LNFN, ([BrkrORRatea] & "/" & [BrkrORRateIA]) AS BrokerORRates
FROM tblCompanyInfo INNER JOIN (tblBrokerInfo LEFT JOIN tblBrokerMonthlyData ON tblBrokerInfo.BrkrID = tblBrokerMonthlyData.BrokerID) ON tblCompanyInfo.CmpnyID = tblBrokerMonthlyData.CompanyID
GROUP BY ([BrkrLN] & " " & [BrkrFN] & [BrkrCompanyName]), ([BrkrORRatea] & "/" & [BrkrORRateIA])
PIVOT tblCompanyInfo.CmpnyName;
Could anyone take a look and point me in the right direction?
Many TIAs!
Mark