I am trying to pull information from a table using criteria entered into a form. The following is the SQL of they query that I am trying to get to work. This is only the portion of the query that I can not get to work, there is more, but it is way too much to post.
My problem is that if there are dates entered for "Brokerage Commissions" and non "Brokerage Commissions", the query seems to use the range entered for non "Brokerage Commissions" only. If I only input a date range for "Brokerage Commissions", I do get the correct period for them. If I only input a date for non "Brokerage Commissions", I get everything in that date range.
Hopefully this makes sence, if not let me know.
Thanks.
SELECT tblRepCommissions.RepNo, tblRepCommissions.ProductType, tblRepCommissions.Amount
FROM (tblRepCommissions INNER JOIN RepTable ON tblRepCommissions.RepNo = RepTable.RepID) INNER JOIN tblProductTypes ON tblRepCommissions.ProductType = tblProductTypes.ProductType
WHERE (((tblRepCommissions.ProductType)<>"Brokerage Commissions"
AND ((tblRepCommissions.Date) Between [Forms]![frmRepReportCriteria]![BegDate] And [Forms]![frmRepReportCriteria]![EndDate])) OR (((tblRepCommissions.ProductType)="Brokerage Commissions"
AND ((tblRepCommissions.Date) Between [Forms]![frmRepReportCriteria]![BrokBegDate] And [Forms]![frmRepReportCriteria]![BrokEndDate]));
My problem is that if there are dates entered for "Brokerage Commissions" and non "Brokerage Commissions", the query seems to use the range entered for non "Brokerage Commissions" only. If I only input a date range for "Brokerage Commissions", I do get the correct period for them. If I only input a date for non "Brokerage Commissions", I get everything in that date range.
Hopefully this makes sence, if not let me know.
Thanks.
SELECT tblRepCommissions.RepNo, tblRepCommissions.ProductType, tblRepCommissions.Amount
FROM (tblRepCommissions INNER JOIN RepTable ON tblRepCommissions.RepNo = RepTable.RepID) INNER JOIN tblProductTypes ON tblRepCommissions.ProductType = tblProductTypes.ProductType
WHERE (((tblRepCommissions.ProductType)<>"Brokerage Commissions"