DCount Rookie Question

G

Guest

I am self-taught on this software and just beginning to understand syntax.

I am trying to do what seems to be a simple DCOUNT and I don't have it
right. I want to count the times in a specific date range that the records
in the Denial Specific Info Table has the First Level Appeal Determination
Field register "Denied."

My most recent attempt didnt even include the date range question and it is
not working
Expr1: DCount("[RecordID]","[Denial Specific Info]","[First Level Appeal
Determinations]='Denied'").

Now, my Denial Specific Info table has three test records. One = "Denied"
and Two = "Granted." When I run the query with the syntax I have I get
a table with one field titled Expr1. In that field there are three rows with
a "1" in each row. So it did count the number of "Denied" I have but it
repeated it for the same number of records in the original table.
 
R

Rick Brandt

knowshowrosegrows said:
I am self-taught on this software and just beginning to understand
syntax.

I am trying to do what seems to be a simple DCOUNT and I don't have it
right. I want to count the times in a specific date range that the
records in the Denial Specific Info Table has the First Level Appeal
Determination Field register "Denied."

My most recent attempt didnt even include the date range question and
it is not working
Expr1: DCount("[RecordID]","[Denial Specific Info]","[First Level
Appeal
Determinations]='Denied'").

Now, my Denial Specific Info table has three test records. One =
"Denied" and Two = "Granted." When I run the query with the syntax I
have I get
a table with one field titled Expr1. In that field there are three
rows with a "1" in each row. So it did count the number of "Denied"
I have but it repeated it for the same number of records in the
original table.

Normally one would not use DCount() in a query except in very special
circumstances. It would typically be used in a form or report or in code to
return a count from "some other query or table".

In a query you just show the Totals row in the query designer by using
"Show - Totals" from the menu and then use Count in the grid as the Totals
option. The SQL of such a query would be...

SELECT Count(*)
FROM [Denial Specific Info]
WHERE [First Level Appeal] = "Denied"
AND DateFieldName >= #2007-01-01#
AND DateFieldName < #2007-03-28#
 
G

Guest

Aha! Another light comes on. That SQL worked perfectly.
--
Thanks


Rick Brandt said:
knowshowrosegrows said:
I am self-taught on this software and just beginning to understand
syntax.

I am trying to do what seems to be a simple DCOUNT and I don't have it
right. I want to count the times in a specific date range that the
records in the Denial Specific Info Table has the First Level Appeal
Determination Field register "Denied."

My most recent attempt didnt even include the date range question and
it is not working
Expr1: DCount("[RecordID]","[Denial Specific Info]","[First Level
Appeal
Determinations]='Denied'").

Now, my Denial Specific Info table has three test records. One =
"Denied" and Two = "Granted." When I run the query with the syntax I
have I get
a table with one field titled Expr1. In that field there are three
rows with a "1" in each row. So it did count the number of "Denied"
I have but it repeated it for the same number of records in the
original table.

Normally one would not use DCount() in a query except in very special
circumstances. It would typically be used in a form or report or in code to
return a count from "some other query or table".

In a query you just show the Totals row in the query designer by using
"Show - Totals" from the menu and then use Count in the grid as the Totals
option. The SQL of such a query would be...

SELECT Count(*)
FROM [Denial Specific Info]
WHERE [First Level Appeal] = "Denied"
AND DateFieldName >= #2007-01-01#
AND DateFieldName < #2007-03-28#
 

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

Access 2003 DCount Syntax Rookie 4
Access Dcount (multiple criteria) 3
Access Dcount function in access 0
DCount Report Question 2
DCount Question 5
Dcount question 6
Count number of records by date 2
dcount 1

Top