Filtered Records

D

DS

I have a Table with three fields that are based on Day and Time of the
computer.

The fields are MenuID, StartDay, StartTime, EndTime.

The standard function of if the StartTime and the EndTime are on the
same day it works fine. The problem is if the EndTime is after Midnite.

I made this code, I was wondering...am I on the right track, wrong track
or completely on the wrong track? Any help or insight I would appreciate.

Thanks
DS

SELECT MenuDetails.MenuID, MenuDetails.StartDay, MenuDetails.StartTime,
MenuDetails.EndDay, MenuDetails.EndTime
FROM MenuDetails
WHERE (((MenuDetails.StartDay)=Weekday(Now())) AND
((MenuDetails.StartTime)<=Time()) AND ((MenuDetails.EndTime)>=Time()))
OR (((MenuDetails.StartTime)<=Time()) AND
((MenuDetails.EndDay)=Weekday(Now())));
 
D

DS

DS said:
I have a Table with three fields that are based on Day and Time of the
computer.

The fields are MenuID, StartDay, StartTime, EndTime.

The standard function of if the StartTime and the EndTime are on the
same day it works fine. The problem is if the EndTime is after Midnite.

I made this code, I was wondering...am I on the right track, wrong track
or completely on the wrong track? Any help or insight I would appreciate.

Thanks
DS

SELECT MenuDetails.MenuID, MenuDetails.StartDay, MenuDetails.StartTime,
MenuDetails.EndDay, MenuDetails.EndTime
FROM MenuDetails
WHERE (((MenuDetails.StartDay)=Weekday(Now())) AND
((MenuDetails.StartTime)<=Time()) AND ((MenuDetails.EndTime)>=Time()))
OR (((MenuDetails.StartTime)<=Time()) AND
((MenuDetails.EndDay)=Weekday(Now())));
I came up with this. Is it any better!
Thanks
DS
SELECT MenuDetails.MenuID, MenuDetails.StartDay, MenuDetails.StartTime,
MenuDetails.AfterMidnite, MenuDetails.EndTime
FROM MenuDetails
WHERE (((MenuDetails.StartDay)=Weekday(Now())) AND
((MenuDetails.StartTime)<=Time()) AND ((MenuDetails.EndTime)>=Time()))
OR (((MenuDetails.StartDay)=Weekday(Now()-1)) AND
((MenuDetails.AfterMidnite)=-1) AND ((MenuDetails.EndTime)>=Time()));
 
Top