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()));
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Combining 2 DCounts 2
SQL to DCount 4
Combining 2 Queries 2
DateDiff Problem 9
DCount Syntax 6
ControlSource Not Working 3
After Midnite Problem 4
datediff calculation on Access Form 5

Top