Using DCOUNT on filtered result

A

azu_daioh

I'm having trouble with this DCOUNT, please help!!

The Forms.[FOReport] is filtered by 4 category:
EntryDate
DateCleared
FONum
EEName


But on the same form, I would like a total of the following:
NewReferrals = which is the total of all records with EntryDate
11/01/07 - 11/30/07
OldReferrals = which is the total of all records with DateCleared
11/01/07 - 11/30/07 And EntryDate before 11/01/07

I have this DCOUNT:
Dim xBDate = Me.fltrBDATE --> which is 11/01/07
Dim xEDate = Me.fltrEDATE --> which is 11/30/07

xTotalOldRef= DCount("[EntryDate]", "[ID Flag]", Me.Filter & _
" And DateCleared > #" & xBDate - 1 & _
"# And DateCleared < #" & xEDate + 1 & "# ")

Me.OldReferrals = xTotalOldRef

The above DCount only gives me the total of old referrals with date
cleared 11/01/07-11/30/07 BUT NOT with EntryDate before 11/01/07

I tried inserting AND EntryDate < #" & xBDate & "# but it didnt
work.

Can someone solve this for me please . I would greatly appreciate it.

Thank you,
Sharon
 
A

azu_daioh

OOps, I typed the wrong part here
Dim xBDate = Me.fltrBDATE --> which is 11/01/07
Dim xEDate = Me.fltrEDATE --> which is 11/30/07


Should be:

Dim xBDate As Date
Dim xEDate As Date

xBDate = Me.filtrBDate
xEDate = Me.filtrEDate
 

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