On 26 Jan 2006 08:42:31 -0800, Tanya wrote:
> I am using a query with a parameter as the source for a report. The
> parameter prompts for the date a class was held and the class code. In
> the report I want to calculate the number of people who registered for
> and actually attended that class. I was trying to use the following
> DCount function, but I keep getting an error message:
> =DCount("[Registrants]","Class ListQry","[Date]=[Enter class date]").
> Registrants is the name of the field I want to count, Class ListQry is
> the query name and [Enter date] is the parameter as it appears in the
> query. Any idea why this is creating an error. Thanks in advance.
Several mistakes.
1) Your table name ("Class ListQry") contains a space. Enclose the
name within brackets inside the quotes, i.e. "[Class ListQry]".
2) Date is a reserved Access/VBA/Jet word and should not be used as a
field name.
For additional reserved words, see the Microsoft KnowledgeBase article
for your version of Access:
109312 'Reserved Words in Microsoft Access' for Access 97
209187 'ACC2000: Reserved Words in Microsoft Access'
286335 'ACC2002: Reserved Words in Microsoft Access'
321266 'ACC2002: Microsoft Jet 4.0 Reserved Words'
3) The [Enter Class Date] parameter prompt must be concatenated into
the criteria, otherwise Access is looking for a literal "Enter Class
Date" value.
4) A date value must be enclosed within the date delimiter symbol #.
Try:
=DCount("[Registrants]","[Class ListQry]","[DateField] = #" & [Enter
Class Date] & "#")
Note: I've used a generic [DateField] in the Where clause. Change it
to whatever name you change your [Date] field to.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
|