Results 1 to 4 of 4
  1. #1
    brittb is offline Novice
    Windows XP Access 2007
    Join Date
    Jan 2012
    Posts
    2

    Calculation based on count of records in a query

    Hi,



    I'm trying to create report that will have calculated values based on the number of returned records for a query. The query returns records based on the date, so the number of records returned will change day to day. The calculations in the report should reflect the fluctuating number of records in the query. Hopefully that makes sense.

    So in the report, I have a text box with the Control Source:

    =13.2+4.4*Count([QueryName].[FieldName])

    Access seems to like the context okay (no error messages in Design View), but I get an error when I go to Report View. Is there some other way I should be telling it to count the number of records in the query? Is there something wrong with the syntax?

    Thanks!

  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,642
    Try

    =13.2+4.4*DCount("*", "[QueryName]")
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    brittb is offline Novice
    Windows XP Access 2007
    Join Date
    Jan 2012
    Posts
    2
    Thanks! That fixed it.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    No problem, and welcome to the site by the way!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. count the number of records from a query
    By Nixx1401 in forum Queries
    Replies: 4
    Last Post: 05-24-2011, 06:45 PM
  2. Query to count records
    By jpkeller55 in forum Access
    Replies: 4
    Last Post: 10-24-2010, 09:24 AM
  3. Count IIf based on records above and below
    By William McKinley in forum Queries
    Replies: 19
    Last Post: 09-17-2010, 04:49 PM
  4. Count distinct records in parameterized query
    By SilverSN95 in forum Access
    Replies: 5
    Last Post: 07-27-2010, 09:31 AM
  5. Replies: 7
    Last Post: 07-22-2010, 01:14 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