Results 1 to 2 of 2
  1. #1
    bryanwank is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2012
    Posts
    2

    Percentage based on Count

    Hey guys,

    (Mods I apologize if this is the wrong section)
    I'm teaching myself access because our database's were overwhelming excel. I don't know VBA so I am missing some of the functionality of excel's functions. Here is what I would like to do, please let me know if it's possible.

    I have a table with the name of a report, the items on the report, and the number of items on the report. I would like to count the instances of the names of the individual reports that appear on another table and then divide that count by the number of items on the report.



    Does that make sense?

    Thanks in advance,
    Bryan

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    Possibilities:

    1. Do an aggregate query on the 'other' table that counts the records grouped by report name:
    SELECT ReportName, Count(*) As ReportCount GROUP BY ReportName;
    Then join that query to the first table on the ReportName fields.

    2. Use DCount function - this is a domain aggregate function (DSum, DCount, DAvg, etc.):
    SELECT *, DCount("*","[other table]","ReportName='" & [ReportName] & "'") As ReportCount FROM [first table];
    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: 3
    Last Post: 01-19-2012, 06:02 PM
  2. MessageBox Based on Recordset Count
    By Two Gun in forum Forms
    Replies: 3
    Last Post: 12-25-2011, 07:54 AM
  3. Calculate Percentage based on previous column
    By VictoriaAlbert in forum Queries
    Replies: 1
    Last Post: 08-13-2011, 01:30 PM
  4. Count of field based on specific values
    By tazzmann67 in forum Access
    Replies: 2
    Last Post: 03-30-2011, 09:11 AM
  5. Count IIf based on records above and below
    By William McKinley in forum Queries
    Replies: 19
    Last Post: 09-17-2010, 04:49 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