filtering only current month values

Ravi Kumar

Registered User.
Local time
Today, 19:56
Joined
Aug 22, 2019
Messages
162
Hi all ,
I have a query in which I need to filter only current month records , but using Month(now()) it is not filtering .
Below is my SQL , can you tell me how to do this?
SQL:
SELECT [OT and Absenteeism by month].[Date of Entry By Month], [OT and Absenteeism by month].[Sum Of OT (hrs)], [OT and Absenteeism by month].[Sum Of Absentees (hrs)], [OT and Absenteeism by month].[Count Of Master_table]
FROM [OT and Absenteeism by month];
 
I do not see you using Month(now()) ?

However, it would be along the lines of

Code:
Month([OT and Absenteeism by month].[Date of Entry By Month]) = Month(Now())
or

Code:
Month([OT and Absenteeism by month].[Date of Entry By Month]) = Month(Date)

HTH
 
you will probably need to add something about years as well.

and erm, spaces in column and table names :(
 
you will probably need to add something about years as well.

and erm, spaces in column and table names :(
Sorry , I try to avoid them ny using underscore but sometimes I forget ..will correct them
 
INMNSHO, underscores are as bad as spaces but Access likes them. I prefer CamelCase. Rather than separating words with spaces or underscores, just capitalize the first letter of each. It's pretty easy to read and less to type. I also hate to have to shift to type an underscore. When I was writing in COBOL, the separator was the dash and since all code was upper case, we didn't have the option of CamelCase.

I only use the_underscore when I want to emphasize the separation.
 
Hi Ravi. If by "current month" you mean from the 1st to the end of this month, then I prefer using a WHERE clause similar to this:

Code:
...WHERE DateField Between DateSerial(Year(Date()),Month(Date()),1) And DateSerial(Year(Date()),Month(Date())+1,0)
 

Users who are viewing this thread

Back
Top Bottom