Link to home
Start Free TrialLog in
Avatar of dpokerbear
dpokerbearFlag for Australia

asked on

Using Reports Recordset in a DCount Function

I am using this code in a ControlSource of a text box on a Report. It doesn't work as it doesn't like the syntax which states Me.Recordset.

=DCount("SatisfactionRating", Me.Recordset,"SatisfactionRating = 1")

Please advise if you know what would be correct syntax for the above function. Thanks.
Avatar of Jim Dettman (EE MVE)
Jim Dettman (EE MVE)
Flag of United States of America image


  Instead of Me.Recordset, you need to use whatever the report is using.  If it's a table, name the table.  If it's a query, name the query.

 You also could get the Dcount in code.

JimD.
Avatar of dpokerbear

ASKER

Hi JDettman,

I know that [RecordSource] can be used and that just gets whatever table or query is listed under that property.

However, when I am opening the report using docmd.openreport, i specify a WHERE clause. So i actually need to work with the recordset you see, otherwise it will display all records for that table or query and I don't want that...
ASKER CERTIFIED SOLUTION
Avatar of Jim Dettman (EE MVE)
Jim Dettman (EE MVE)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Jim,

I made a query to work around the problem.

Thanks for the effort in assisting me with this problem.