Results 1 to 4 of 4
  1. #1
    noop71 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jan 2013
    Posts
    2

    Dsum nightmare

    Hi there!

    I have a table (table1)
    that table has several columns: company / Qty / date / ERT

    I want to be able to run a query that will group all the records by Company and by date and provide the sum of QTY - as well as the cumulative totals for each company and date.

    My query looks like this:
    amonth: MONTH CODE
    Group By
    assending

    Field 1: Alias: Company
    Group by
    Ascending

    Field 2: QTY
    Table1


    Sum

    Field 3: Runtot: DSum("qty","table1","[month code]=" & [amonth] & " And [company]=" & [alias] & "")

    I have the query set up - but my runtotal Dsum formula is giving me grief - specifically a #ERROR and I can't figure it out

    I basically want it to look like this:

    A company 15/Nov/2012 10 10
    A Company 16/Nov/2012 10 20
    B Company 12/Jan/2012 15 15
    B Company 21/Mar/2012 5 20

    is this even possible??

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,624
    If field is text type, need apostrophe delimiter:

    Field 3: Runtot: DSum("qty","table1","[month code]=" & [amonth] & " And [company]='" & [alias] & "'")

    Not understanding the field [alias]. Where is this field?

    Instead of DSum, try an aggregate (GROUP BY) query. Or build a report using Grouping and Sorting with aggregate calcs in group footer.
    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
    noop71 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jan 2013
    Posts
    2

    no joy

    Quote Originally Posted by June7 View Post
    If field is text type, need apostrophe delimiter:

    Field 3: Runtot: DSum("qty","table1","[month code]=" & [amonth] & " And [company]='" & [alias] & "'")

    Not understanding the field [alias]. Where is this field?

    Instead of DSum, try an aggregate (GROUP BY) query. Or build a report using Grouping and Sorting with aggregate calcs in group footer.



    Thanks for the quick response

    the "Alias" is the field name for the field Company (just like amonth is the field name for month code) - I wanted to seperate the field
    name from the table name to avoid confusion.

    I can't use a group by (or report footer) as this will sum the totals for me - what I need are cumulative totals for each incremental date
    code for each company.

    thanks for the correction of the text fields though - good catch - though it didn't solve the problem - still getting #error

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,624
    I don't understand any of this. I will have to review your file to analyse structure. If you want to provide, follow instructions at bottom of my post.
    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. Inventory nightmare
    By smeghead67 in forum Database Design
    Replies: 5
    Last Post: 06-13-2012, 07:06 PM
  2. Corruption nightmare
    By Remster in forum Access
    Replies: 4
    Last Post: 03-25-2011, 06:40 AM
  3. help with combo box nightmare
    By Bigthinkor in forum Access
    Replies: 2
    Last Post: 01-13-2011, 10:28 PM
  4. Tabbing nightmare
    By Remster in forum Forms
    Replies: 3
    Last Post: 11-24-2010, 11:35 AM
  5. 1 to many nightmare
    By damian_gareau in forum Access
    Replies: 0
    Last Post: 07-11-2007, 12:10 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