On Tuesday, 18 October 2011 16:43:53 UTC+1, John W. Vinson wrote:
> On Tue, 18 Oct 2011 06:11:25 -0700 (PDT), Colin Weir
> <colin...@blueyonder.co.uk> wrote:
>
> >Hi
> >
> >Thanks for getting back to me - it worked great! Unfortunately I was counting the wrong thing. I've changed it to the Query it's meant to count, however it's giving me #Error again.
> >
> >Can you help me please?
> >
> >=DCount("[Reference Number]","[NLCT Carers]”,”[NLCT Carers]![Date Joined] >= #" & Nz([txtstartdate]) & "# And [Date Joined] <= #" & Nz([txtenddate] & "#"))
> >
> >Thanks
> >
> >Colin
>
> What's NLCT Carers? Does it contain the Date Joined and Reference Number
> fields?
>
> If you just want to count records (without specifying which field within the
> record) you can use
>
> =DCount("*", "queryname", "criteria")
> --
>
> John W. Vinson [MVP]
> Microsoft's replacements for these newsgroups:
> http://social.msdn.microsoft.com/For...-US/accessdev/
> http://social.answers.microsoft.com/.../en-US/addbuz/
> and see also http://www.utteraccess.com
Thanks
NLCT Carers is a query that contains both Reference Number and date joined.I changed the formula as you described to
=DCount("*","[NLCT Carers]","[Date Joined]>= ([txtstartdate]) And <= ([txtenddate])")
Which throws up an error. I then tried
=DCount("*","[NLCT Carers]","'[Date Joined]>=[txtstartdate] And <= [txtenddate]'")
However this is counting all the records prior to any information being entered into txtstartdate and txtenddate.
Hope you can help?
Colin