Query

pratlin

New Member
Joined
Apr 28, 2018
Messages
4
[h=1]I am creating a library database system which contains a table called "loan". The loan table contains the book id, borrower, and date/time. How would I create a query to show me the books that were loaned between yesterday's 5pm and today's 9am?[/h]
 

Some videos you may like

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
53,650
Office Version
365
Platform
Windows
Welcome to the Board!

The key thing to understand is how Access and Excel store dates. They store them as numbers, specifically the number of days since 1/0/1900. And time is just the fraction of a day. So 9:00 AM could be represented by 9/24.

So, to get a date/time range between 5:00 PM the previous day and 9:00 AM today, you could use this as the Criteria in your Date field in your Query:
Code:
Between (Date()-(7/24)) And (Date()+(9/24))
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
53,650
Office Version
365
Platform
Windows
You are welcome!:)
 

Watch MrExcel Video

Forum statistics

Threads
1,102,351
Messages
5,486,356
Members
407,541
Latest member
Emilybuhman

This Week's Hot Topics

Top