View Full Version : Using date and a value to make a text box true


spn200286
03-27-2008, 12:12 PM
Hey all, i got another small problem with this bloody database!

The problem today folks is this, im making a booking system (well the booking is a small part of the overall system) so i have DateArrive, RoomID, and all the usual.

now what i want is to make a query that says
if DateArrive & RoomID (Booking Table) then make RoomOccupied(Room Table) true

if that makes sense, i tried some in sql and got the date bit working, but wasn't sure how to go further so as to make it so RoomID is involved

(ill say in another way If a room is booked on a specific day i want to make Occupied true)

thanks for anymore help u can give

RuralGuy
03-27-2008, 01:00 PM
I would say the room is not occupied until the client "checks in".

raskew
03-27-2008, 03:46 PM
To carry Allan's comment a step further, I'd want to insert a mechanism to show a yet to be occupied room as reserved, thus ensuring the room is not double-booked.

Bob

spn200286
03-28-2008, 04:08 AM
not quite what i meant, ill try again below is teh tables i have
http://i71.photobucket.com/albums/i136/King-b-/RoomAvaliableBooking.jpg
what i want is when date is today occupied to room to become true
i have the SQL

SELECT Room.RoomID, Booking.DateArrive
FROM Room INNER JOIN Booking ON Room.RoomID=Booking.RoomID
WHERE (((Booking.DateArrive)=Date()));

but want to extend for something like
Update Room
Set Occupied = true
where (Select DateArrive FROM Booking WHERE (((Booking.DateArrive) = Date()))

if that makes sense

or have i missed a point you have made

RuralGuy
03-28-2008, 05:31 AM
I believe the point both of us were trying to make is that if this is a real world application then the room does not become occupied automatically as you are trying to do. It is a manual process.

spn200286
03-28-2008, 05:36 AM
I believe the point both of us were trying to make is that if this is a real world application then the room does not become occupied automatically as you are trying to do. It is a manual process.

Ah ok, just thought it would be nice to have it done automatic, ill just keep it manual then, was just thinking it would make it easier.

i now see what you ment by reserved option

cheers

RuralGuy
03-28-2008, 06:24 AM
Easier is fine as is automatic, unless doing so makes the data inaccurate.