DCount - Counting Selected Records in a Report

dmugan

Registered User.
Local time
Today, 17:07
Joined
Aug 13, 2002
Messages
13
Hello:

In a calculated control in a report, I put the following syntax:

(DCount("[Mod received date]","table1","[mod received date]>=[forms]![dialog]![date1]")

This isn't working, I think because I am using dates and need to put in #s? However, what I really want to do is count the mod received date records that fall within the range (between) the user inputed dates entered in a form, i.e. between [forms]![dialog]![date1] and [forms]![dialog]![date2] but I just can't figure out the syntax.

Any help would be much appreciated.
 
Have a look at the quick example I've done for you

IMO
 

Attachments

Thanks IMO, I got an error message and could not open your attached file. If is not too much trouble, could you cut and paste the code here so I can get an idea....
 
I created a query that counts the records between the dates entered on the form, something like...

SELECT Count(tblTheDate.TheDate) AS [Count]
FROM tblTheDate
WHERE (((tblTheDate.TheDate) Between [forms]![frmTheDate]![TxtDate1] And [forms]![frmTheDate]![TxtDate2]));

and called it qryCountDate. The TxtDate1 and TxtDate2 of course being the controls on the form where the user enters the Dates. Then all that is needed is an unbound TextBox on the report that looks up the query...

=DLookUp("[Count]","qryCountDate","")

'Count' being the column that counts the Dates in the query.
Hope this helps. let me know how you get on.

IMO

PS Attached is the A97 version
 

Attachments

Thanks IMO, it worked perfectly! Very much appreciated and keep up the good work.
 
Glad you got it working

IMO
 

Users who are viewing this thread

Back
Top Bottom