Table name and field names I’ve used:
Tbl_bookings
Booking No
Boarding Arrival Date
Boarding Departure Date
So far I’ve been using the criteria:
>=[Enter the arrival date]And<=[Enter the departure date]
under the arrival date field.
The SQL for the query is as follows:
Expand|Select|Wrap|Line Numbers
- SELECT tbl_bookings.[Booking No], tbl_bookings.[Boarding Arrival Date], tbl_bookings.[Boarding Departure Date]
- FROM tbl_bookings
- WHERE (((tbl_bookings.[Boarding Arrival Date])>=[Enter Arrival Date] And (tbl_bookings.[Boarding Arrival Date])<=[Enter Departure Date]));
For example the test data I’m currently using is as follows:
Test Data
Expand|Select|Wrap|Line Numbers
- Booking No Arrives Departs
- 2 01/01/2008 08/01/2008
- 5 07/01/2008 12/01/2008
- 6 07/01/2008 12/01/2008
- 7 07/01/2008 12/01/2008
- 9 09/02/2008 14/02/2008
- 10 09/02/2008 14/02/2008
However if I enter 06/01/2008 to13/01/2008 only bookings 5,6,7 are returned yet booking 2 should also have been
I have the same problem again entering values such as 10/01/2008 to 11/02/2008, bookings 9,10 are returned but not 5,6,7.
I quite new to using access and was wondering if someone could point me in the right direction as to how to develop this query so that it works for when the departure date entered is not less than or equal to dates that are stored in the system.
Many Thanks