Help with Date and Time Query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
Try that

SELECT Time, Date
FROM MyTable
WHERE (Time>=11 AND Date=[DateParameter]) OR (Time<=6 AND
Date=[DateParameter]+1)
 
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)
 

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

Back
Top