View Single Post
  #5  
Old May 20th, 2010, 10:39 AM posted to microsoft.public.access.reports
jim_s via AccessMonster.com
external usenet poster
 
Posts: 7
Default Creating a printed report containing multiple counts

I've actually worked around this now by creating two queries for each stat -
one to take a recordset out and the second one to count it. Thanks for the
reply anyway John- to be honest it looks like that dCount would work rather
than the one I was using. My dCount assumed that because the values entered
in the text boxes were formatted in short date, Access would already pass the
format over to queries as opposed to dCount or the queries actually needing
to be specified the format.

Which coincidenally brings me to another problem. Although the solution I
came up with does work, it's not passing the dates correctly to the queries
(before I was testing it by entering parameters from a prompt box). I believe
you can specify in a query what format to read the value as, but this would
involve a lot of work to change 50+ queries. Ah well.

John Spencer wrote:
So, can you post one of the DCount calls that does not work?

I would expect to see something like the following. Assuming that you have an
open form that has two controls on it that contain the start and end of the
period.

=DCount("SomeField","SomeTable","SomeDateField Between " &
Format(Forms![YourFormname]![PeriodStart],"\#yyyy-mm-dd\#") & " AND "
Format(Forms![YourFormname]![PeriodEnd],"\#yyyy-mm-dd\#") )

Of course, using DCOUNT might not be best way to get the counts you need. A
query might be. But you have not shared any details on what you need to do.

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County

DCount works fine as long as the input dates for the underlying query are
static. When the underlying query contains parameters (as passed from the

[quoted text clipped - 10 lines]

Without knowing your DCounts it is impossible to tell what is wrong.


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ports/201005/1