Results 1 to 3 of 3
  1. #1
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    DCount() Function Criteria (2003)

    I'm trying to use the QryCountHours query in the attached mdb to count how many hours an appliance has worked during the day.
    On the startup form, please set begin date to 01/01/2006 and end date to 30/06/2006 and run the QryCountHours query. You can see that the ore_f column displays zeroes throughout while it should hold 24 for most of the days.
    Here's the QryCountHours query:
    <font color=448800>SELECT DCount("giorno","query14","giorno = " & previsioni.giorno) AS ore_f, Previsioni.Giorno
    FROM (Previsioni INNER JOIN Vap1 ON Previsioni.Giorno=Vap1.GIORNO) INNER JOIN Vap2 ON Previsioni.Giorno=Vap2.GIORNO
    GROUP BY Previsioni.Giorno
    HAVING (((Previsioni.Giorno) Between forms!Grafici!text0 And forms!Grafici!text2));</font color=448800>

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: DCount() Function Criteria (2003)

    Why do you include Vap1 and Vap2?
    Why do you use Query14?
    Why do you use DCount?

    Doesn't the following query based on Previsioni do what you want?

    SELECT Giorno, Count(Ora) AS Ore_f
    FROM previsioni
    WHERE [1kWh] Is Not Null OR [2kWh] Is Not Null
    GROUP BY Giorno
    HAVING Giorno Between [forms]![Grafici]![text0] And [forms]![Grafici]![text2]

  3. #3
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: DCount() Function Criteria (2003)

    You're right as usual Hans.
    The fact is the original QryCountHours query drew fields from Vap1 and Vap2 as well but your solution works all the same <img src=/S/smile.gif border=0 alt=smile width=15 height=15>.
    <img src=/S/thankyou.gif border=0 alt=thankyou width=40 height=15>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •