Using Dcount with combo box and date range (1 Viewer)

RyLane

Registered User.
Local time
Yesterday, 21:29
Joined
Feb 4, 2014
Messages
60
Hi,

I would like to have a text box display the number of records for a selected title that fall within a selected date range. Been looking around for a while and have this so far;

=DCount("Discussion_Title","Discussions","[Discussion_Title]='" & [cboType] & "' And [Discussion_Date] = Between ([txtStartDate] And [txtEndDate])'")

I get an #Error message. Any ideas? I just threw that together because it describes what I want, but I know there are syntax problems.

Thanks
 

KenHigg

Registered User
Local time
Yesterday, 21:29
Joined
Jun 9, 2004
Messages
13,327
Something like -

=DCount("Discussion_Title","Discussions","[Discussion_Title]='" & [cboType] & "' And [Discussion_Date] = Between #'" & ([txtStartDate] & "'# And #'" & [txtEndDate]) &'#")

???
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 18:29
Joined
Aug 30, 2003
Messages
36,128
Or perhaps:

=DCount("Discussion_Title","Discussions","[Discussion_Title]='" & [cboType] & "' And [Discussion_Date] Between #" & [txtStartDate] & "# And #" & [txtEndDate] & "#")
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 18:29
Joined
Aug 30, 2003
Messages
36,128
Happy to help!
 

Users who are viewing this thread

Top Bottom