How To Output Total Sales From Query.....

G

Guest

hey i have a quick question on a query which isnt working at the moment.

My query looks at 2 tables named: 'receipt main' and 'receipt details'
Below is a list of fields in each table:
RECEIPT MAIN: PK receiptNo, ReceiptDate, Salesperson
RECEIPT DETAILS: PK receiptNo, PK ProductNo,Quanitity, Price

My query is that i want the total price for all products sold on a
particular date. Below is my sql for the query:


SELECT Sum(CCur([Receipt Details]![Price]*[Receipt Details]!Quantity)) AS
[Total Sales], [Receipt Main].[Receipt Date]
FROM [Receipt Main] INNER JOIN [Invoice Details] ON [Receipt Main].ReceiptNo
= [Receipt Details].ReceiptNo
WHERE ((([Receipt Main].[Receipt Date])=[Please Enter Date]));


But this comes up with the following error: You tried to execute a query
that does not include the specified expression ‘Receipt Date’ as part of an
aggregate function. All help solving this problem would be great :)
 
G

Guest

If you do not need the query to show the date and just the sum

SELECT Sum(CCur([Receipt Details]![Price]*[Receipt Details]!Quantity)) AS
[Total Sales]
FROM [Receipt Main] INNER JOIN [Invoice Details] ON [Receipt Main].ReceiptNo
= [Receipt Details].ReceiptNo
WHERE ((([Receipt Main].[Receipt Date])=[Please Enter Date]));

If you need the date
SELECT Sum(CCur([Receipt Details]![Price]*[Receipt Details]!Quantity)) AS
[Total Sales], [Receipt Main].[Receipt Date]
FROM [Receipt Main] INNER JOIN [Invoice Details] ON [Receipt Main].ReceiptNo
= [Receipt Details].ReceiptNo
GROUP BY [Receipt Main].[Receipt Date]
HAVING ((([Receipt Main].[Receipt Date])=[Please Enter Date]));
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top