Calculate Totals From Parameter Query in A Report

L

LiseD

I would like to calculate the totals from a parameter query in a report but
keep getting an error message using the following:

=DCount("*","[Query_Name]")

How does one do this? Still fairly new to Access...

Thank you.
 
J

John W. Vinson

I would like to calculate the totals from a parameter query in a report but
keep getting an error message using the following:

=DCount("*","[Query_Name]")

How does one do this? Still fairly new to Access...

Thank you.

Well...

How you would do it depends strongly on what you want to do, the error you're
getting, the nature of your tables, the SQL of your query, and the nature of
the parameters. Nobody on the newsgroups can see any of these. Care to give us
a bit of help?
 
L

LiseD

I have a parameter query from a table that has donor info. The parameters I
have set up are:

Select Gender

Select Blood Group

Select Age From AND Age To

I have a report from this query with these parameters, but when I use the
following in the report footer, instead of getting a count of these records,
I get error instead:

=DCount("*","[Select_Gender_Blood_Group_Age]")

John W. Vinson said:
I would like to calculate the totals from a parameter query in a report but
keep getting an error message using the following:

=DCount("*","[Query_Name]")

How does one do this? Still fairly new to Access...

Thank you.

Well...

How you would do it depends strongly on what you want to do, the error you're
getting, the nature of your tables, the SQL of your query, and the nature of
the parameters. Nobody on the newsgroups can see any of these. Care to give us
a bit of help?
 
J

John Spencer

Unless you are referencing form controls on an OPEN form as parameters that is
going to fail. If you just have a standard parameter prompt, DCount will have
no idea what the values of the parameters are and will generate an error -
probably, 2001 You cancelled the previous operation.

The following query will fail when using DCOUNT against the stored query

SELECT *
FROM SomeTable
WHERE fieldGender = [Gender]

The following query will succeed IF the form is open
SELECT *
FROM SomeTable
WHERE fieldGender = Forms![GetCriteriaForm]![comboboxSelectGender]

John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
I have a parameter query from a table that has donor info. The parameters I
have set up are:

Select Gender

Select Blood Group

Select Age From AND Age To

I have a report from this query with these parameters, but when I use the
following in the report footer, instead of getting a count of these records,
I get error instead:

=DCount("*","[Select_Gender_Blood_Group_Age]")

John W. Vinson said:
I would like to calculate the totals from a parameter query in a report but
keep getting an error message using the following:

=DCount("*","[Query_Name]")

How does one do this? Still fairly new to Access...

Thank you.
Well...

How you would do it depends strongly on what you want to do, the error you're
getting, the nature of your tables, the SQL of your query, and the nature of
the parameters. Nobody on the newsgroups can see any of these. Care to give us
a bit of help?
 
L

LiseD

Thank you, but I am not sure what you mean. I am not using this in a form.

I am using the parameter queries to generate a report. It is in the report
that I don't get a result, just an error in the field I created with that
expression. No error message such as 2001, just "error".

I am trying to get a count of the records that are selected from the
parameter that is entered for each of the parameters separately.

John Spencer said:
Unless you are referencing form controls on an OPEN form as parameters that is
going to fail. If you just have a standard parameter prompt, DCount will have
no idea what the values of the parameters are and will generate an error -
probably, 2001 You cancelled the previous operation.

The following query will fail when using DCOUNT against the stored query

SELECT *
FROM SomeTable
WHERE fieldGender = [Gender]

The following query will succeed IF the form is open
SELECT *
FROM SomeTable
WHERE fieldGender = Forms![GetCriteriaForm]![comboboxSelectGender]

John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
I have a parameter query from a table that has donor info. The parameters I
have set up are:

Select Gender

Select Blood Group

Select Age From AND Age To

I have a report from this query with these parameters, but when I use the
following in the report footer, instead of getting a count of these records,
I get error instead:

=DCount("*","[Select_Gender_Blood_Group_Age]")

John W. Vinson said:
I would like to calculate the totals from a parameter query in a report but
keep getting an error message using the following:

=DCount("*","[Query_Name]")

How does one do this? Still fairly new to Access...

Thank you.
Well...

How you would do it depends strongly on what you want to do, the error you're
getting, the nature of your tables, the SQL of your query, and the nature of
the parameters. Nobody on the newsgroups can see any of these. Care to give us
a bit of help?
 

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