Reservation SQL Query

  • Thread starter kellya via AccessMonster.com
  • Start date
K

kellya via AccessMonster.com

I have recently been tring to model a hotel reservations database I found the
following query online it says it is supposed to query my reservations table
for available rooms by date:

SELECT *
FROM tblReservations
WHERE Room_Id NOT in (select Room_Id from tblReservations where
RequestedStartDate <= EndBookingDate and RequestedEndDate >= StartBookingDate
);

Question # 1
I am new to sql parameter queries and what I don't undestand is why I have
to input a start bookingdate and an endbookingdate. Shouldn't the user just
add the input the requested dates the guest would like to find the rooms
available within the time frame

Question # 2
I would like to know if i can insert use this query in a form where the user
inserts the request dates via a combo boxes and calendar control, clicks a
control button and gets the results in another form.Is this possible using
vbcode as well?
 
M

[MVP] S.Clark

1. There are no Access parameters in this query. If you are getting the
parameter prompts, then that means that Access doesn't know what those field
names are.

Most queries are not bolt-on or plug & play. They must be tailored to the
data tables of which they are querying.

2. You can use "a" query, but maybe not "this" query. You can do those
other things as well.

Do you have a table named Reservations? Does it have all of the field names
listed in this SQL?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top