Computing total sales with a query

C

cdrennon

I need to generate a query which will list total sales by customer. I
have the first and last names from a Customer table, price from an
Inventory table, and quantity from a Sales table. In query design I
have lastname, firstname, and totalsales. For total sales I have
entered totalsales:=[Quantity]*[Price].

This will list the customer and the individual items*quantity, but
there is one line for every item purchased. I need the customer and
the total sales to show up as one line.

When i try sum([Quantity]*[Price]) for totalsales I get an error "You
tried to execute a query that does not include the specified
expression 'LastName' as part of an aggregate function."

Thanks
 
D

Dale Fye

You have to change the query to an Aggregate query. Look for the symbol in
the query design menu that looks like a M rolled over on its left side (click
that symbol).

In the query grid, you will now see a row labeled "Total" and it should have
the term "Group By" entered under each of the columns. Go to your TotalSales
column and change this to Sum.

Now run your query.
 
C

cdrennon

You have to change the query to an Aggregate query.  Look for the symbol in
the query design menu that looks like a M rolled over on its left side (click
that symbol).

In the query grid, you will now see a row labeled "Total" and it should have
the term "Group By" entered under each of the columns.  Go to your TotalSales
column and change this to Sum.

Now run your query.

----
HTH
Dale

cdrennon said:
I need to generate a query which will list total sales by customer. I
have the first and last names from a Customer table, price from an
Inventory table, and quantity from a Sales table. In query design I
have lastname, firstname, and totalsales. For total sales I have
entered totalsales:=[Quantity]*[Price].
This will list the customer and the individual items*quantity, but
there is one line for every item purchased. I need the customer and
the total sales to show up as one line.
When i try sum([Quantity]*[Price]) for totalsales I get an error "You
tried to execute a query that does not include the specified
expression 'LastName' as part of an aggregate function."

That was exactly the info I needed. Thank you very much Dale!
 

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

Similar Threads

Sales Ranks 1
Ranking Customers based on Total Sales 2
Updateable Query 3
Building expression problem using Access Query. 4
total a query 1
Combining 3 queries 2
Invalid Use of Null 1
SUM NOT INCLUDING ALL RECORDS 4

Top