Results 1 to 6 of 6
  1. #1
    JonathanT is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jan 2011
    Posts
    141

    Counting records of a parameter query

    I have a report based on a parameter query and I want to count the records returned by the query.

    I am using a calculated field in the report header to count the number of records returned. The query works fine every time. I always get a #error every time in the calculated field on the report. Here's what I've tried in the calculated field.

    resnumber is the field to count
    breakfast is the query name

    =dcount("[resnumber]","breakfast")
    =dcount("[resnumber]","[breakfast]")


    =count(*)

    Any help would be appreciated. The report and query can be redesigned completey if necessary

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    A Report has a RecordSource and that RecordSource has a Me.Recordset.RecordCount

  3. #3
    JonathanT is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jan 2011
    Posts
    141
    I'm sorry, I'm still not clear on this.

    My report has a recordsource which is the paramter query.

    How do I utilize the Me.Recordset.RecordCount?

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Use it instead of the DCount() you were trying.

  5. #5
    JonathanT is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jan 2011
    Posts
    141
    Problem solved. I had my control in the page header instead of the report header. I ended up using =count(*) as the control source in my text box. I also used another text box in the detail section with =1 as the Control Source and Over All as the running sum to give me a running count.

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Great! Thanks for posting back with your success and solution.

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

Similar Threads

  1. Counting Detail Records by Group
    By Paul H in forum Reports
    Replies: 7
    Last Post: 10-21-2011, 02:53 PM
  2. Finding and counting (not records but entries)
    By gpbanseo in forum Queries
    Replies: 3
    Last Post: 07-14-2011, 04:35 AM
  3. Counting Only Certain Records
    By jtphenom in forum Queries
    Replies: 9
    Last Post: 03-29-2011, 01:25 AM
  4. Counting Records
    By WhiteNite1971 in forum Access
    Replies: 1
    Last Post: 01-22-2011, 06:36 AM
  5. Counting returned records in a query
    By johncob in forum Queries
    Replies: 0
    Last Post: 02-11-2009, 05:30 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