hello, i am using the between statements to search between two date periods and then between specific times on those dates. if i search with the following criteria:
Start Date = 11/07/2011, End Date = 12/07/2011
Start Time = 11:55:00 PM, End Time = 12:05:00 AM
it returns wrong results. i think this is due to going over midnight to the next day so it searches between times 12.05AM to 11:55PM on a single day instead of 11.55PM to 12.05AM. Does anyone know how to get it to search past midnight? SQL code used is below.
Thanks
Text36 = start date
Text38 = finish date
Text9 = start time
Text11 = finish time
Code:
SELECT DISTINCT Historical_Data.MessageNo, Historical_Data.DateTime, Historical_Data.UserName, Historical_Data.FCS, Historical_Data.KKSCode, Historical_Data.Message
FROM Historical_Data
WHERE DateValue((Historical_Data.DateTime) BETWEEN Forms!Main_Form!Text36 AND Forms!Main_Form!Text38 AND TimeValue(Historical_Data.DateTime) BETWEEN Forms!Main_Form!Text9 AND Forms!Main_Form!Text11));