• Notice regarding image hosts and attachments. See here.

Access Database Help

Associate
Joined
19 Mar 2005
Posts
569
Currently making an access hotel booking system and am abit stuck, need to produce a report of the people checking out within 2 days

I have used

Code:
DateAdd("d",2,Date())

Which picks up check outs 2days in advance but I cant quite figure out how to do within 2days :confused:.

Just wondering how I would do this?

Edit.
have tried put <= but this returns results of past bookings, how can i get it to only display checkouts from today onwards till 2 days have gone?

Edit.

Do I need to compare the value to the date()?

Anyone please?
 
Last edited:
Cheers Beepcake

Is it something like the code below which I cant get to work

Code:
SELECT Customer.CustomerID, Customer.FirstName, Customer.Surname, Rooms.RoomNum, Rooms.RoomType, Booking.Arrival, Booking.Checkout
FROM Rooms INNER JOIN (Customer INNER JOIN Booking ON Customer.CustomerID = Booking.CustomerID) ON Rooms.RoomNum = Booking.Room
WHERE (DateDiff("d",Booking.Arrival,Date())>0 And DateDiff("d",Booking.Checkout,Date()) < 0);
 
Last edited:
Solved it in the end with

Code:
SELECT Customer.CustomerID, Customer.FirstName, Customer.Surname, Rooms.RoomNum, Rooms.RoomType, Booking.Arrival, Booking.Checkout
FROM Rooms INNER JOIN (Customer INNER JOIN Booking ON Customer.CustomerID = Booking.CustomerID) ON Rooms.RoomNum = Booking.Room
WHERE (((DateDiff("d",[Arrival],Date()))>0) AND ((DateDiff("d",[Checkout],Date()))<0));

Damn Square Brackets needed for field names in where clause.
 
Back
Top Bottom