Ill try excplain.
Im desiging a reservation system. You can book a place for a periode of time.
I have a combobox on a form which displays the free spots left after looking at the formbegindate and forumenddate that the user filled in.
Here is the problem
When a spot has been reserved more then once it does get in the list were it not shoud be. For example:
i want to place a reservation for 1-9-2004 to 1-10-2004.
Now the query starts looking. It sees:
Spot 4 is allready been reserved for 4-9-2004 tot 8-9-2004 so it returns a false and doenst show in the list (so far so good)
But spot 4 had also been reservated for 1-1-2004 to 10-1-2004. This date does not compete with the reservationdate and the query returns a TRUE and it DOES show in the combolist, but als you notice, it was been reserved for 4-9-2004 tot 8-9-2004 so this is wrong.
My question:
Its there a way to solve this?
Is there a way that i can say conform the example: if spot 4 is taken then not show
Here is the query
SELECT Locatie.Soort, Locatie.Elektra, Locatie.Locatiecode
FROM Locatie LEFT JOIN Reservering ON Locatie.Locatiecode = Reservering.Locatiecode
WHERE (((Reservering.Begindatum)>=[Formulieren]![Reserveren]![Begindatum]) AND (([Formulieren]![Reserveren]![Einddatum])<=[Begindatum])) OR ((([Formulieren]![Reserveren]![Einddatum])>=[Einddatum]) AND ((Reservering.Einddatum)<=[Formulieren]![Reserveren]![Begindatum])) OR (((Locatie.Locatiecode) Not In ([reservering].[locatiecode])))
ORDER BY Locatie.Locatiecode;
thanks in advance
joost
Im desiging a reservation system. You can book a place for a periode of time.
I have a combobox on a form which displays the free spots left after looking at the formbegindate and forumenddate that the user filled in.
Here is the problem
When a spot has been reserved more then once it does get in the list were it not shoud be. For example:
i want to place a reservation for 1-9-2004 to 1-10-2004.
Now the query starts looking. It sees:
Spot 4 is allready been reserved for 4-9-2004 tot 8-9-2004 so it returns a false and doenst show in the list (so far so good)
But spot 4 had also been reservated for 1-1-2004 to 10-1-2004. This date does not compete with the reservationdate and the query returns a TRUE and it DOES show in the combolist, but als you notice, it was been reserved for 4-9-2004 tot 8-9-2004 so this is wrong.
My question:
Its there a way to solve this?
Is there a way that i can say conform the example: if spot 4 is taken then not show
Here is the query
SELECT Locatie.Soort, Locatie.Elektra, Locatie.Locatiecode
FROM Locatie LEFT JOIN Reservering ON Locatie.Locatiecode = Reservering.Locatiecode
WHERE (((Reservering.Begindatum)>=[Formulieren]![Reserveren]![Begindatum]) AND (([Formulieren]![Reserveren]![Einddatum])<=[Begindatum])) OR ((([Formulieren]![Reserveren]![Einddatum])>=[Einddatum]) AND ((Reservering.Einddatum)<=[Formulieren]![Reserveren]![Begindatum])) OR (((Locatie.Locatiecode) Not In ([reservering].[locatiecode])))
ORDER BY Locatie.Locatiecode;
thanks in advance
joost