From: whiz on
Hi, I'm using the DCount function where the WHERE clause portion is a
string variable. The string variable includes the Date function. I get
a "You Canceled The Previous Operation" at the point of the DCount and
suspect the problem is in the string variable.Below is my sting
variable assignment and DCount code. I appreciate any advice to fix.

strWhereIn = "([LISNRLS] < #" & Date & "#) AND ([LISNRLS] >= #" &
(Date - 7) & "#) AND ([PO#PR] Like ""G*"")"

rec("In") = DCount("[PO#PR]", strProgramTablePO, _
From: Rich P on
DCount returns an integer value which would be the count of rows in a
table (or dataset -- query) that meet a giver criteria. I'm not sure
what -- rec("In") -- represents. Here is a sample usage of DCount
(including the source data -- from Table2)

'--source data for DCount example from Table2
fyear fld1 fld2

2000 abc1 abc12
2000 abc1 abc13
2001 abc1 abc12
2002 abc1 abc12
2002 abc1 abc13

Sub DcountThing()

Dim i As Integer
i = DCount("[fld2]", "Table2", "InStr(1,[fld2],'2')>0")
Debug.Print "i is " & i

End Sub

This will return a "3" because there are 3 rows where fld2 contains a
"2" in the value.


*** Sent via Developersdex ***