I want to know which is the best way to create a SQL statement in MS Access to query the Time range value.
Table : LOGTIMES
Sample: I got two fields that is used for storing the schedule (SCHEDFROM and SCHEDTO) and both are of the DATETIME data type
Suppose this is the schedule of an employee
SchedFrom SchedTo
7:00 8:30
8:45 9:30
Scenario: I want to check if the new record containing SchedFrom: 9:00 and SchedTo 10:00 will conflict with the available scheds above. Technically, this should have a conflict since anytime between 9:00 to 9:30 is allocated to the 2nd sched above. Unfortunately, my query below doesn't detect this properly. Don't know if I still need any string conversions.
Query:
SELECT * FROM LOGTIMES WHERE SCHEDFROM >=#9:00# AND SCHEDTO <=#10:00#
Table : LOGTIMES
Sample: I got two fields that is used for storing the schedule (SCHEDFROM and SCHEDTO) and both are of the DATETIME data type
Suppose this is the schedule of an employee
SchedFrom SchedTo
7:00 8:30
8:45 9:30
Scenario: I want to check if the new record containing SchedFrom: 9:00 and SchedTo 10:00 will conflict with the available scheds above. Technically, this should have a conflict since anytime between 9:00 to 9:30 is allocated to the 2nd sched above. Unfortunately, my query below doesn't detect this properly. Don't know if I still need any string conversions.
Query:
SELECT * FROM LOGTIMES WHERE SCHEDFROM >=#9:00# AND SCHEDTO <=#10:00#