Dates in criteria again

L

Louise

Dear Experts,

Now you have sparked my curiousity:) Can you enter two
dates and have access scan available rooms for occupancy
during those times? The table I have books students into a
bed with a code between an arrival and leaving date.

many thanks

Louise
 
K

Ken Snell

In a query, you can use the Between ... And syntax to bracket a range:

Between #1/1/2004# And #1/31/2004#
 
J

John Spencer (MVP)

Yes, you can.

From your description, I am guessing that you have a record something like

StudentID, RoomNumber, DateIN, and DateOut.

You are trying to get roomnumbers that are occupied between two dates
(StartPeriod, EndPeriod)

That means that the DateIN should be BEFORE the EndPeriod and DateOut Should be
AFTER StartPeriod. This will get every room that is occupied AT SOME TIME
during the StartPeriod to EndPeriod.

WHERE DateIN <=[End Period] AND DateOut >= [Start Period]
 
Top