DLookUp and DCount Problem

J

John Daily

I am having a problem with DLookUp and DCount. First I don't know which one to use where. I need to count records in a table based on a particular date range. I have the report pulling info from a query and I can't include the data from the other table. The data becomes distored some how and it pulls the wrong number
Here is what I tried to do

=DCount("[acct_num]","tbl_Reporting","Month([trans_date] = '10'"

I have an expression built into my query that the report pulls other data from that prompts the user for the number of the month. That is where the '10' is in the equation. The expression is called [Expr1]

Am I way off track with trying to get this data or should I just link the report to the table that has the data in it

Thanks in advance

John
 
K

Ken Snell

Use DCount:

=DCount("*","tbl_Reporting","Month([trans_date]) = '10'")

To use a field name instead of 10:


=DCount("*","tbl_Reporting","Month([trans_date]) = '" & [FieldName] & "'")


--
Ken Snell
<MS ACCESS MVP>


John Daily said:
I am having a problem with DLookUp and DCount. First I don't know which
one to use where. I need to count records in a table based on a particular
date range. I have the report pulling info from a query and I can't include
the data from the other table. The data becomes distored some how and it
pulls the wrong number.
Here is what I tried to do:

=DCount("[acct_num]","tbl_Reporting","Month([trans_date] = '10'")

I have an expression built into my query that the report pulls other data
from that prompts the user for the number of the month. That is where the
'10' is in the equation. The expression is called [Expr1].
Am I way off track with trying to get this data or should I just link the
report to the table that has the data in it?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top