C
ChuckW
Hi,
I created a form that has a text box for start date and a
text box for end date. I also have text boxes for states
and then a button that runs a report. I am trying to
create something that would allow a sales rep to enter in
a start date, and end date and then up to ten states into
the various text boxes. It is going against a table that
has data back to 2000. The problem is that the date
restrictors are not working. It sums up sales by
customer for the entire table rather than the start and
end dates I specify. I am not getting any error messages
either. Below is my SQL. Can anyone help?
Thanks,
Chuck
SELECT AllDB.CustomerName, AllDB.state, Sum
(AllDB.Subtotal) AS SumOfSubtotal,
Customer.SalesRepRef_FullName
FROM AllDB INNER JOIN Customer ON AllDB.CustomerName =
Customer.FullName
WHERE (((AllDB.TxnDate) Between [Forms]![SelectState]!
[txtStartDate] And [Forms]![SelectState]![txtEndDate]))
GROUP BY AllDB.CustomerName, AllDB.state,
Customer.SalesRepRef_FullName
HAVING (((AllDB.state)=[Forms]![SelectState]![txtState]
Or (AllDB.state)=[Forms]![SelectState]![txtState2] Or
(AllDB.state)=[Forms]![SelectState]![txtState3] Or
(AllDB.state)=[Forms]![SelectState]![txtState4] Or
(AllDB.state)=[Forms]![SelectState]![txtState5] Or
(AllDB.state)=[Forms]![SelectState]![txtState6] Or
(AllDB.state)=[Forms]![SelectState]![txtState7] Or
(AllDB.state)=[Forms]![SelectState]![txtState8] Or
(AllDB.state)=[Forms]![SelectState]![txtState9] Or
(AllDB.state)=[Forms]![SelectState]![txtState10]));
I created a form that has a text box for start date and a
text box for end date. I also have text boxes for states
and then a button that runs a report. I am trying to
create something that would allow a sales rep to enter in
a start date, and end date and then up to ten states into
the various text boxes. It is going against a table that
has data back to 2000. The problem is that the date
restrictors are not working. It sums up sales by
customer for the entire table rather than the start and
end dates I specify. I am not getting any error messages
either. Below is my SQL. Can anyone help?
Thanks,
Chuck
SELECT AllDB.CustomerName, AllDB.state, Sum
(AllDB.Subtotal) AS SumOfSubtotal,
Customer.SalesRepRef_FullName
FROM AllDB INNER JOIN Customer ON AllDB.CustomerName =
Customer.FullName
WHERE (((AllDB.TxnDate) Between [Forms]![SelectState]!
[txtStartDate] And [Forms]![SelectState]![txtEndDate]))
GROUP BY AllDB.CustomerName, AllDB.state,
Customer.SalesRepRef_FullName
HAVING (((AllDB.state)=[Forms]![SelectState]![txtState]
Or (AllDB.state)=[Forms]![SelectState]![txtState2] Or
(AllDB.state)=[Forms]![SelectState]![txtState3] Or
(AllDB.state)=[Forms]![SelectState]![txtState4] Or
(AllDB.state)=[Forms]![SelectState]![txtState5] Or
(AllDB.state)=[Forms]![SelectState]![txtState6] Or
(AllDB.state)=[Forms]![SelectState]![txtState7] Or
(AllDB.state)=[Forms]![SelectState]![txtState8] Or
(AllDB.state)=[Forms]![SelectState]![txtState9] Or
(AllDB.state)=[Forms]![SelectState]![txtState10]));