T
Terri
I am trying to extract records based on the month and day being today's date.
I created two separate fields in the table, one for month (MonthofYear) and
one for the day (DayofYear).
I am unable to restrict the records in the query. No matter what I have
tried the records containing a value in these fields are always selected no
matter what the values are.
This is a portion of query. Any help is greatly appreciated.
WHERE (((tblDutyOfficerTasks.DayShift)=Yes) AND
((tblDutyOfficerTasks.MonthofYear)=Month(Date())) AND
((tblDutyOfficerTasks.DayofYear)=Day(Date()))) OR
(((tblDutyOfficerTasks.DayShift)=Yes) AND
((tblDutyOfficerTasks.DayofWeek)=Format(Date(),"dddd"))) OR
(((tblDutyOfficerTasks.DayShift)=Yes) AND
((tblDutyOfficerTasks.DayofWeek)="Every Day")) OR
(((tblDutyOfficerTasks.DayShift)=Yes) AND
((tblDutyOfficerTasks.DayofWeek)="Weekdays Only") AND
((Weekday(Date()))="2")) OR (((tblDutyOfficerTasks.DayShift)=Yes) AND
((tblDutyOfficerTasks.DayofWeek)="Weekdays Only") AND
((Weekday(Date()))="3")) OR (((tblDutyOfficerTasks.DayShift)=Yes) AND
((tblDutyOfficerTasks.DayofWeek)="Weekdays Only") AND
((Weekday(Date()))="4")) OR (((tblDutyOfficerTasks.DayShift)=Yes) AND
((tblDutyOfficerTasks.DayofWeek)="Weekdays Only") AND
((Weekday(Date()))="5")) OR (((tblDutyOfficerTasks.DayShift)=Yes) AND
((tblDutyOfficerTasks.DayofWeek)="Weekdays Only") AND ((Weekday(Date()))="6"))
Thank you,
Terri
I created two separate fields in the table, one for month (MonthofYear) and
one for the day (DayofYear).
I am unable to restrict the records in the query. No matter what I have
tried the records containing a value in these fields are always selected no
matter what the values are.
This is a portion of query. Any help is greatly appreciated.
WHERE (((tblDutyOfficerTasks.DayShift)=Yes) AND
((tblDutyOfficerTasks.MonthofYear)=Month(Date())) AND
((tblDutyOfficerTasks.DayofYear)=Day(Date()))) OR
(((tblDutyOfficerTasks.DayShift)=Yes) AND
((tblDutyOfficerTasks.DayofWeek)=Format(Date(),"dddd"))) OR
(((tblDutyOfficerTasks.DayShift)=Yes) AND
((tblDutyOfficerTasks.DayofWeek)="Every Day")) OR
(((tblDutyOfficerTasks.DayShift)=Yes) AND
((tblDutyOfficerTasks.DayofWeek)="Weekdays Only") AND
((Weekday(Date()))="2")) OR (((tblDutyOfficerTasks.DayShift)=Yes) AND
((tblDutyOfficerTasks.DayofWeek)="Weekdays Only") AND
((Weekday(Date()))="3")) OR (((tblDutyOfficerTasks.DayShift)=Yes) AND
((tblDutyOfficerTasks.DayofWeek)="Weekdays Only") AND
((Weekday(Date()))="4")) OR (((tblDutyOfficerTasks.DayShift)=Yes) AND
((tblDutyOfficerTasks.DayofWeek)="Weekdays Only") AND
((Weekday(Date()))="5")) OR (((tblDutyOfficerTasks.DayShift)=Yes) AND
((tblDutyOfficerTasks.DayofWeek)="Weekdays Only") AND ((Weekday(Date()))="6"))
Thank you,
Terri