Dcount with nested filter?

A

azu_daioh

Form1
controls: fltrBDate, fltrBDate, fltrFO, fltrEE
with the following event procedure:

stDocName = "Monthly FO Report"
stWCondition = "EntryDate > #" & Me.fltrBDate - 1 & "# And
EntryDate < #" & Me.fltrEDate + 1 & "# And FO_ID =" & Me.fltrFO & "
And EE_ID =" & Me.fltrEE & " "

DoCmd.OpenForm stDocName, , , stWCondition


this opens and filters Form2
Form2
unbound controls: TotalA, TotalB, TotalCDE
TotalA = count the number of records with "yes" on bound control
ClrAtInitial
TotalB = count the number of records with "yes" on bound control
NotClrAtInitial
TotalCDE = count the number of records with "yes" on bound controls
ClrByClmt or ClrByEE or ClrByOther

Form2 has event procedure onCurrent

Dim numTotalA As Long, fltTotalA As Long
numTotalA = DCount("[EntryDate]", "[ID Flag]", "ClrAtInitial=yes")

If Me.FilterOn Then
fltTotalA = DCount("[EntryDate]", "[ID Flag]", "ClrAtInitial=yes"
And Me.Filter)
Me.TotalA = fltTotalA
Else
fltTotalA = numTotalA
Me.TotalA = fltTotalA
End If

-----
But I can't figure out how to add "ClrAtInitial=yes" after the
Me.Filter because in addition to the filter on Form1 specified by the
user, TotalA should only display the count of records ClrAtInitial=yes

I'm not very good at VB, the above codes where just codes I found from
this newsgroup. Please help. Thank you,


Sharon
 

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

Similar Threads


Top