Help with Date and Time Query

R

Rob

I hope somebody can help me with this,

I have a Date field and a Time field. I would Like to enter the date into
the query and have it retrieve the records for that date from 11:00 Am to
06:00 Am the next day.

Any help would be appreicated

Thanks
 
O

Ofer

Try that

SELECT Time, Date
FROM MyTable
WHERE (Time>=11 AND Date=[DateParameter]) OR (Time<=6 AND
Date=[DateParameter]+1)
 
V

Van T. Dinh

SELECT T.*
FROM [YourTable] AS T
WHERE ( (T.[Date] = [Enter Date:]) AND (T.[Time] >= #11:00:00#) )
OR ( (T.[Date] = [Enter Date:] + 1) AND (T.[Time] <= #06:00:00#) )

Since "Date" and "Time" are reserved words in VBA, I recommend changing the
Field names to avoid problems when you do VBA coding in the database later.

HTH
Van T. Dinh
MVP (Access)
 
Top