query criteria

  • Thread starter Thread starter Jessica
  • Start date Start date
J

Jessica

Hello,


I have a query with a Production date, a start time, and finish time fields.
I want to get records starting from 4:30 yesterday morning to 16:30 today.
What would I have to use as a criteria?

Thanks,
Jess
 
Assuming that you ProductionDate Field has zero time component and your
StartTime & FinishTime Fields have zero date component, you can use
something like:

.... WHERE ( ( [ProductionDate] + [StartTime] )
BETWEEN ( Date() - 1 + #04:30# ) And ( Date() + #16:30# ) )

Alternatively, the following may be more efficient, especially if you have
indices on the ProductionDate and StartTime:

.... WHERE ( ( [ProductionDate] = Date() - 1 ) And ( [StartTime] >=
#04:30# ) )
OR ( ( [ProductionDate] = Date() ) And ( [StartTime] <= #16:30# ) )
 

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


Back
Top