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?