Query Date and Hours Fields

ckeezer

Registered User.
Local time
Today, 06:16
Joined
Sep 9, 2005
Messages
13
Ok I have a tbl with the following fields:
Name
Date
Activity
Hours

I have a form with these fields on it and two additional fields:
Total Hours
Hours this Month

Those fields need to do just what they say, calculate the total hours and calculate total hours for the current month only.

Here is the code that I have thus far, that is not working:
SELECT tblVolunteers.Date, tblVolunteers.Name, Sum(tblVolunteers.Hours) AS tot
FROM tblVolunteers
GROUP BY tblVolunteers.Date, tblVolunteers.Name
HAVING (((tblVolunteers.Date)=Month(Now())))
ORDER BY tblVolunteers.Name;


If I take out the "=Month(Now)) portion I can get the total hours, so that part is done, I just figured that out..... I get nothing back on the above sql statement.

What am I missing?

Chuck
 
It looks to me like you are comparing a date to a Month value!
Code:
HAVING (((tblVolunteers.Date)=Month(Now())))
How about comparing Month to Month with:
Code:
HAVING (Month(tblVolunteers.Date)=Month(Date()))
 

Users who are viewing this thread

Back
Top Bottom