Results 1 to 4 of 4
  1. #1
    Jen0dorf is offline Competent Performer
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    UK
    Posts
    453

    total sales showing on a form

    Hi

    Have a database with two tables, one for customers and one for their purchases.

    I've created a form structure which shows each customer with their purchases in a sub form.

    I need to show the total value of all sales to all customers

    I've created a query using this code:

    SELECT Sum(Ornament.Cost) AS SumOfCost FROM XmasOrnaments;

    This does when run show the total sales.

    How can I use this query to show the total sales on my form?

    thanks

    Ian

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Why does the query reference two tables - Ornament and XmasOrnaments?

    One option is expression in textbox that pulls data directly from table, query not needed: =DSum("Cost", "XmasOrnaments")
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Jen0dorf is offline Competent Performer
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    UK
    Posts
    453
    Hi

    sorry was typo been a long day - outside lights for xmas :-) and then visit from 3 year old hyper grandson

    that code sounds great my learning curve on VBA is slow but sure.

    I did look at Dcount but rejected it as an option. Didn't come across DSum

    off to rest my weary bones -

    thanks

    Ian

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Domain aggregate functions are not strictly VBA. They can be used in VBA but Access objects (queries, forms, reports) can use them just fine. DCount and DSum are only 2 of many.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 15
    Last Post: 11-25-2014, 03:42 PM
  2. Replies: 3
    Last Post: 12-16-2013, 01:43 PM
  3. Replies: 0
    Last Post: 12-13-2012, 03:18 AM
  4. Replies: 5
    Last Post: 06-30-2011, 02:24 AM
  5. computing total sales per day using query
    By joms222 in forum Queries
    Replies: 0
    Last Post: 03-09-2009, 10:58 PM

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