dcount question!

J

JOM

I have a a report derived from a query. The report has employees and there
are several fields that have a yes/no checkbox. I am trying to count the
yess' based on an employee footer this is what I have in the undbound text box
=DCount("[ChangeVOE]","[EmpID]=Query![Individual Follow Up
Query]![EmpID]","[ChangeVOE]=True")
this is giving me an error, is there someone who can help me please on this
issue?

OJ!
 
B

Bearmouse

HI Jom,

You have 2 sets of criteria in your statement and you don't specify what
domain (table) you are using. D functions can lookup any table/query even if
it isn't in your report. Also if EMPID is already in your report you, you can
concatonate the string
as you see below.

DCount («expr», «domain», «criteria»)


=DCount("[ChangeVOE]","tblWhatever",[EmpID]= " & [EmpID] & "and
[ChangeVOE]=True")

Hope that helps,

Bearmouse
 
J

John Vinson

I have a a report derived from a query. The report has employees and there
are several fields that have a yes/no checkbox. I am trying to count the
yess' based on an employee footer this is what I have in the undbound text box
=DCount("[ChangeVOE]","[EmpID]=Query![Individual Follow Up
Query]![EmpID]","[ChangeVOE]=True")
this is giving me an error, is there someone who can help me please on this
issue?

OJ!

The second argument of DCount (or any of the domain functions) should
be the name of a Table or of a Query. It should not be an expression;
and Query! is meaningless in Access, you cannot refer to a query
collection because there isn't one in that sense.

I'm GUESSING - not being able to see the database - that you want

=DCount("[ChangeVOE]", "[Individual Follow Up Query]",
"[ChangeVOE]=True AND [EmpID] = " & [EmpID])

to search for the records in [Individual Follow Up Query] for the
currently displayed EmpID, counting only records with ChangeVOE equal
to True.

John W. Vinson[MVP]
 
J

JOM

Thanks John, that worked well for me, I appreaciate your comments and help,
they were a learning experience!

John Vinson said:
I have a a report derived from a query. The report has employees and there
are several fields that have a yes/no checkbox. I am trying to count the
yess' based on an employee footer this is what I have in the undbound text box
=DCount("[ChangeVOE]","[EmpID]=Query![Individual Follow Up
Query]![EmpID]","[ChangeVOE]=True")
this is giving me an error, is there someone who can help me please on this
issue?

OJ!

The second argument of DCount (or any of the domain functions) should
be the name of a Table or of a Query. It should not be an expression;
and Query! is meaningless in Access, you cannot refer to a query
collection because there isn't one in that sense.

I'm GUESSING - not being able to see the database - that you want

=DCount("[ChangeVOE]", "[Individual Follow Up Query]",
"[ChangeVOE]=True AND [EmpID] = " & [EmpID])

to search for the records in [Individual Follow Up Query] for the
currently displayed EmpID, counting only records with ChangeVOE equal
to True.

John W. Vinson[MVP]
 
Top