Results 1 to 13 of 13
  1. #1
    eeps24 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2015
    Posts
    39

    Question how to combine (sum) the dollar amounts per vendor

    I have a report that lists vendors and the accounts used to pay these vendors along with the total $ amount.



    If you look at my screen shot you will see vendor "healthtrax international" for example. You will see there are multiple payments paid to this vendor from account 100101. We are a multi entity company, for example we have companies 101 and 120. How do I combine all those payments from account 100101 in to one total?

    I want it to combine for both entities (company 101 and 120). So basically, I only want to have 1 line of account 100101 for this vendor. Ultimately I want to do this for for every vendor with every account.

    To throw in a curve ball, we used those same accounts to pay other vendors, I want to keep each vendor separate. (as you can see above in my screenshot charles warner also uses 100101 but I DONT want to combine that total with healthtrax)

    Click image for larger version. 

Name:	combine gl.PNG 
Views:	12 
Size:	47.7 KB 
ID:	23445

    here is my code

    SELECT dbo_APVENMAST.VENDOR_VNAME AS VENDOR_NAME, dbo_APVENMAST.VENDOR AS VENDOR_NUM, dbo_APVENMAST.VEN_CLASS, dbo_APDISTRIB.DIST_COMPANY, dbo_APDISTRIB.DIS_ACCT_UNIT AS ACCOUNTING_UNIT, dbo_GLNAMES.DESCRIPTION AS DEPT, dbo_APDISTRIB.ORIG_TRAN_AMT AS DOLLAR_AMT
    FROM dbo_APVENMAST LEFT JOIN ((dbo_APDISTRIB LEFT JOIN dbo_GLMASTER ON (dbo_APDISTRIB.DIS_SUB_ACCT = dbo_GLMASTER.SUB_ACCOUNT) AND (dbo_APDISTRIB.DIS_ACCOUNT = dbo_GLMASTER.ACCOUNT) AND (dbo_APDISTRIB.DIS_ACCT_UNIT = dbo_GLMASTER.ACCT_UNIT) AND (dbo_APDISTRIB.DIST_COMPANY = dbo_GLMASTER.COMPANY)) LEFT JOIN dbo_GLNAMES ON (dbo_GLMASTER.ACCT_UNIT = dbo_GLNAMES.ACCT_UNIT) AND (dbo_GLMASTER.VAR_LEVELS = dbo_GLNAMES.VAR_LEVELS) AND (dbo_GLMASTER.COMPANY = dbo_GLNAMES.COMPANY)) ON dbo_APVENMAST.VENDOR = dbo_APDISTRIB.VENDOR
    WHERE (((dbo_APVENMAST.VEN_CLASS)<>"EMP" And (dbo_APVENMAST.VEN_CLASS)<>"FRN" And (dbo_APVENMAST.VEN_CLASS)<>"ONE" And (dbo_APVENMAST.VEN_CLASS)<>"UTL") AND ((dbo_APVENMAST.CREATE_DATE)>=#4/1/2015# And (dbo_APVENMAST.CREATE_DATE)<=#12/1/2015#));

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    remove DIST CO from the sum query. only sum on VENDOR & ACCTUNIT.

  3. #3
    eeps24 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2015
    Posts
    39
    If I remove DIST CO, it still shows up the same way... i.e. multipile lines for that account.

  4. #4
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    you need to group by and sum - at the moment you just have a select query

  5. #5
    eeps24 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2015
    Posts
    39
    ok, I was thinking that. But If I do a sum for the dollar amount. How do I tell it to keep the sums separate from other vendors? I dont want it to sum up every 100101 account for other vendors.

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    GROUP BY Vendor_Number, Accounting_Unit

    Consider building a report and use its Sorting & Grouping features with aggregate calcs in report and group footer sections. Report allows display of detail info as well as summary calcs.
    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.

  7. #7
    eeps24 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2015
    Posts
    39
    When I do Group by just for those 2 fields, access wont let me run my query. It wants me to do a group by for every field.
    When I put group by for vendor_name, then it complains the next field about the same error. Is there a way I can do group by on just those two fields you mentioned or do they all have to have it?

    Click image for larger version. 

Name:	grp.PNG 
Views:	10 
Size:	18.2 KB 
ID:	23449

  8. #8
    eeps24 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2015
    Posts
    39
    I was able to do the sum (however I had to have group by for every field). It sorted of worked, it group each sum by company. However I just want to have one line for 100101 and grand total. Not 3 lines as you see in mys creen shot. I am almost there

    Click image for larger version. 

Name:	g.PNG 
Views:	9 
Size:	9.5 KB 
ID:	23450

  9. #9
    eeps24 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2015
    Posts
    39
    i think i solved it...the reason it was not grouping was because the description is misspelled. Look at asset's name... After i changed it in our system to correct spelling then did my query it came out as one.

    I want to thank you all for your help. great forum!

  10. #10
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Did you consider a report as suggested in post 6?
    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.

  11. #11
    eeps24 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2015
    Posts
    39
    Quote Originally Posted by June7 View Post
    Did you consider a report as suggested in post 6?
    To answer your question, NO I did not try that "yet". I was going to ask you for more information about that. If What I wanted to do wouldn't work, then I was going to ask you for more direction regarding your idea. Not sure what you meant by report as I am already building one. I am assuming you mean to dump what I have so far in to say excel and do my calculations in there?

  12. #12
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    No, I mean an Access report based on raw data and use its Sorting & Grouping features with aggregate calcs in textboxes in group and footer sections.
    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.

  13. #13
    eeps24 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2015
    Posts
    39
    I guess that would have to be my next course of action if I couldnt fix the issue. Thank you all for your help on this issue.

    Click image for larger version. 

Name:	solved.jpg 
Views:	7 
Size:	137.8 KB 
ID:	23458

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

Similar Threads

  1. Replies: 4
    Last Post: 09-03-2014, 09:48 AM
  2. Replies: 3
    Last Post: 07-01-2014, 08:37 AM
  3. Lookup vendor amounts per customer
    By btr94 in forum Access
    Replies: 9
    Last Post: 07-06-2012, 10:44 AM
  4. Replies: 3
    Last Post: 01-13-2012, 01:15 AM
  5. Replies: 4
    Last Post: 03-31-2010, 03:41 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