General discussion

Locked

Hour/minute queries in Access

By sharon_minick ·
How do you get a query to work with AM and PM time? For instance, I need to query a city database that lists delivery times for all restaurants. If I need a list of all restaurants that deliver after 10:30 PM, I can't bring up the ones that deliver in the AM times after midnight. I can't get a query to work even if I change all the restaurant hours in the database to military time.

Thanks.

This conversation is currently closed to new comments.

3 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Hour/minute queries in Access

by sl-campbell In reply to Hour/minute queries in Ac ...

In order to see what is happening, test this by building a new table called Deliveries and add the fields:
CityID text, ResturantID text, DeliveryDateTime date/time.

Add some data for 2 different months where data for each month spans over 2 days, with different dates and times.

In the query viewer select SQL VIEW and copy this in and then select DESIGN view to see what this represents in the query builder:

SELECT CityID, ResturantID, DeliveryDateTime AS [Deliveries between 10:30 PM and 11:59 AM]
FROM Deliveries
WHERE (((DeliveryDateTime ) Between [Start Date] And [End Date]) AND ((TimeValue([DeliveryDateTime ])) Not Between "22:30:00" And "12:00:00"));

This will invoke you to enter a start and end date but you can remove this if you just always want all dates.

Collapse -

Hour/minute queries in Access

by sharon_minick In reply to Hour/minute queries in Ac ...

Poster rated this answer

Collapse -

Hour/minute queries in Access

by sharon_minick In reply to Hour/minute queries in Ac ...

This question was closed by the author

Back to Software Forum
3 total posts (Page 1 of 1)  

Related Forums