Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / November 2007

Tip: Looking for answers? Try searching our database.

Sum of Numbers question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Halston - 29 Nov 2007 19:29 GMT
I was trying to find the number of items sold by a specific product ID number
in queries, but i can't figure out how to do it. does anyone have any advice
on how i could achieve a task like this?
John W. Vinson - 29 Nov 2007 20:02 GMT
>I was trying to find the number of items sold by a specific product ID number
>in queries, but i can't figure out how to do it. does anyone have any advice
>on how i could achieve a task like this?

Not without some more information!

Have you tried a Totals query? Create a query based on you table and click the
Greek Sigma icon (looks like a sideways M). You can use the default "Group By"
totals operator to group by product ID and change it to Sum on the field that
you want to sum.

            John W. Vinson [MVP]
Michel Walsh - 29 Nov 2007 20:03 GMT
DSUM("quantitySold", "tableNameHere", "productID = 444" )

or, with a query (in SQL view)

SELECT SUM(quantitySold)
FROM tableNameHere
WHERE productID = 444

which will sum the value under the field quantitySold for all the records
having the value 444 under the field productID. You can switch from the SQL
Query view to the Design Query view to see how you could have produce the
same query, graphically.

Hoping it may help,
Vanderghast, Access MVP

>I was trying to find the number of items sold by a specific product ID
>number
> in queries, but i can't figure out how to do it. does anyone have any
> advice
> on how i could achieve a task like this?
Dale Fye - 29 Nov 2007 21:25 GMT
Assuming you have something similar to an OrderDetails table, you could:

1.  Open a new query
2.  Select the ProductID, and quantity fields and add them to the query grid
3.  Make the query an aggregate query (click on the Sigma symbol - looks
like a M laying on its left side - located in about the middle of the query
toolbar).
4.  Change the GroupBy to Sum in the Quantity column, Totals row of the
query grid

Run the query.

HTH
Dale
Signature

Don''t forget to rate the post if it was helpful!

Email address is not valid.
Please reply to newsgroup only.

> I was trying to find the number of items sold by a specific product ID number
> in queries, but i can't figure out how to do it. does anyone have any advice
> on how i could achieve a task like this?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.