Results 1 to 2 of 2
  1. #1
    samsquared is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    May 2021
    Location
    St. Augustine, FL
    Posts
    20

    How do I add a sum to a query?

    I've researched this but I haven't found anything that applies to what I want to do.

    I have a stock info database and one of the tables is for transactions and contains these columns:
    TrxID
    ActionID (buy/sell)
    StockID (link to Stocks table)
    Purchase Date
    Shares
    SharePrice


    Amount


    Using the instructions contained at https://www.vertex42.com/ExcelTempla...ck-quotes.html I now have a table with stock quotes also. The transactions table may contain multiple rows for the same stock. I'd like to create a query that looks like this example for AT&T:

    Stock Symbol Shares Owned Amount Current Value
    AT&T T 450 $xxxxx $yyyyy


    Stock and Symbol are from another linked table
    Shares Owned and Amount would be the sums of 3 transactions (in this case) worth of purchases
    Current Value would be Shares Owned * Current Price. I think I can handle this if I have the total shares owned for the stock.


    How do I get this sum into the query?

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Start a new query with the stock and shares fields. Click on the Totals icon. Change Group By to Sum on the shares field. See if that returns the desired result.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums