Meeting Room Booking display problem

M

Mynor

Hello:

I am trying to create a meeting room booking database. I have been asked to
display a grid by day of the available and used time slots. I have tried so
many things but nothing displays the data the way I need. I need for the
available hours in the day to display at the top and the list of meeting
rooms on the left and then show what meeting room is being used during the
day. I have all the information in tables but this display is just killing
me. Any ideas or suggestion on what to use???


Thanks
 
K

KARL DEWEY

I have all the information in tables but this display is just killing me.
Sounds like a job for crosstab query but without knowing table structure it
is hard to guess.
 
M

Mynor

Hi Karl:
I also have the feeling that it should be a cross tab. I have the following
tables:

Rooms:
Roomid
roomname
location
capacity

Users:
userid
FirstName
LastName
Position

Reservations:
Reservationid
roomid
userid
date
starttime
endtime
comments

I also created a table with all the available hours from 8:00 AM to 7:00 PM
in 30 minutes increments to try to use it as the column headers for the cross
tab but it does not work. Please let me know if you find that I am missing
something or if you have any ideas on how to go about it.

Thanks
 
K

KARL DEWEY

Here is a start that has problems. You will always need to start and end on
half hour.
Create a table name CountNumber with field CountNUM containing numbers from
0 (zero) through your maximum.

RoomReservePeriods --
SELECT DateAdd("n",[CountNUM]*30,[starttime]) AS Room_Periods
FROM Reservations, CountNumber
WHERE (((DateAdd("n",[CountNUM]*30,[starttime]))<[endtime]))
GROUP BY DateAdd("n",[CountNUM]*30,[starttime]);

TRANSFORM First([FirstName] & " " & [LastName]) AS Expr1
SELECT Rooms.roomname
FROM RoomReservePeriods, (Rooms INNER JOIN Reservations ON Rooms.Roomid =
Reservations.roomid) INNER JOIN USERS ON Reservations.userid = USERS.userid
WHERE (((RoomReservePeriods.Room_Periods) Between [starttime] And [endtime]))
GROUP BY Rooms.roomname
PIVOT RoomReservePeriods.Room_Periods;
 
M

Michael Gramelspacher

Hi Karl:
I also have the feeling that it should be a cross tab. I have the following
tables:

Rooms:
Roomid
roomname
location
capacity

Users:
userid
FirstName
LastName
Position

Reservations:
Reservationid
roomid
userid
date
starttime
endtime
comments

I also created a table with all the available hours from 8:00 AM to 7:00 PM
in 30 minutes increments to try to use it as the column headers for the cross
tab but it does not work. Please let me know if you find that I am missing
something or if you have any ideas on how to go about it.

Thanks

I think something like this would work. There is a Calendar table
and a BookTimes table with half-hours. The Insert query fills the
RoomBookTimes table.

This is something similar:
http://www.psci.net/gramelsp/temp/PAtient Appointments.zip

CREATE TABLE BookTimes (
BookTime DATETIME NOT NULL,
PRIMARY KEY (BookTime)
);
CREATE TABLE Calendar (
CalendarDate DATETIME NOT NULL,
IsBusinessDay TINYINT DEFAULT 1 NOT NULL,
PRIMARY KEY (CalendarDate)
);
CREATE TABLE RoomBookTimes (
RoomID TEXT(5) NOT NULL,
CalendarDate DATETIME NOT NULL,
BookTime DATETIME NOT NULL,
PRIMARY KEY (RoomID, CalendarDate, BookTime)
);
CREATE TABLE RoomReservations (
RoomID TEXT(5) NOT NULL,
CalendarDate DATETIME NOT NULL,
BookTime DATETIME NOT NULL,
UserID LONG NOT NULL,
PRIMARY KEY (RoomID, CalendarDate, BookTime, UserID)
);
CREATE TABLE Rooms (
RoomID TEXT(5) NOT NULL,
PRIMARY KEY (RoomID)
);
CREATE TABLE Users (
UserID LONG NOT NULL,
UserName TEXT(50) NOT NULL,
PRIMARY KEY (UserID)
);
INSERT INTO RoomBookTimes ( RoomID, CalendarDate, BookTime )
SELECT Rooms.RoomID, Calendar.CalendarDate, BookTimes.BookTime
FROM Rooms, Calendar, BookTimes
WHERE Calendar.IsBusinessDay=1;

TRANSFORM First(Query1.UserName) AS FirstUserName
SELECT RoomBookTimes.RoomID, RoomBookTimes.CalendarDate
FROM RoomBookTimes LEFT JOIN (SELECT RoomReservations.RoomID,
RoomReservations.CalendarDate,
RoomReservations.BookTime,
Users.UserID,
Users.UserName
FROM RoomReservations
INNER JOIN Users
ON RoomReservations.UserID = Users.UserID) AS Query1 ON
(RoomBookTimes.RoomID = Query1.RoomID) AND (RoomBookTimes.CalendarDate = Query1.CalendarDate) AND
(RoomBookTimes.BookTime = Query1.BookTime)
GROUP BY RoomBookTimes.RoomID, RoomBookTimes.CalendarDate
PIVOT RoomBookTimes.BookTime;
 
M

Mynor

Hi Karl:

Thanks for taking the time to help me. If possible I would like to send you
a picture of what I need to create. I try to post it to the forum but I
don't think that is possible. I am sure that if you see the display it will
make more sense. I have not physically try your suggestion but I looked at
you SQL statement and it does not seem to me that it will give me the result
I am looking for. Please you can write to (e-mail address removed) if you don't
want to post you e-mail address for everyone to see.

Thanks

KARL DEWEY said:
Here is a start that has problems. You will always need to start and end on
half hour.
Create a table name CountNumber with field CountNUM containing numbers from
0 (zero) through your maximum.

RoomReservePeriods --
SELECT DateAdd("n",[CountNUM]*30,[starttime]) AS Room_Periods
FROM Reservations, CountNumber
WHERE (((DateAdd("n",[CountNUM]*30,[starttime]))<[endtime]))
GROUP BY DateAdd("n",[CountNUM]*30,[starttime]);

TRANSFORM First([FirstName] & " " & [LastName]) AS Expr1
SELECT Rooms.roomname
FROM RoomReservePeriods, (Rooms INNER JOIN Reservations ON Rooms.Roomid =
Reservations.roomid) INNER JOIN USERS ON Reservations.userid = USERS.userid
WHERE (((RoomReservePeriods.Room_Periods) Between [starttime] And [endtime]))
GROUP BY Rooms.roomname
PIVOT RoomReservePeriods.Room_Periods;


Mynor said:
Hi Karl:
I also have the feeling that it should be a cross tab. I have the following
tables:

Rooms:
Roomid
roomname
location
capacity

Users:
userid
FirstName
LastName
Position

Reservations:
Reservationid
roomid
userid
date
starttime
endtime
comments

I also created a table with all the available hours from 8:00 AM to 7:00 PM
in 30 minutes increments to try to use it as the column headers for the cross
tab but it does not work. Please let me know if you find that I am missing
something or if you have any ideas on how to go about it.

Thanks
 
M

Mynor

Hello Michael:

Thanks for taking the time to help me. I checked the database that you sent
to me on the link and eventhough it has the functionality similar to what I
am trying to create, it does not have the display I am looking for. If you
want, I can send you a picture of the display. I try to post it but I was
not able to find the way to do it. If you don't want to post your e-mail for
everyone to see you can send it just to me at (e-mail address removed). I am
sure that when you see it, it will make more sense of what I am trying to do.

Again thanks for your help.
 
M

Michael Gramelspacher

Hello Michael:

Thanks for taking the time to help me. I checked the database that you sent
to me on the link and eventhough it has the functionality similar to what I
am trying to create, it does not have the display I am looking for. If you
want, I can send you a picture of the display. I try to post it but I was
not able to find the way to do it. If you don't want to post your e-mail for
everyone to see you can send it just to me at (e-mail address removed). I am
sure that when you see it, it will make more sense of what I am trying to do.

Again thanks for your help.

I think this query would shoe appointments for 1-7 May 2009. You probably need to add a few appoints
to test it.

TRANSFORM First(Query3.patient_name) AS [Patient Name]
SELECT Doctors.doctor_name,
DoctorSchedule.calendar_date
FROM Doctors
INNER JOIN (DoctorSchedule
LEFT JOIN (SELECT PatientAppointments.patient_num,
PatientAppointments.doctor_num,
PatientAppointments.calendar_date,
PatientAppointments.appt_time,
Patients.patient_name
FROM Patients
INNER JOIN PatientAppointments
ON Patients.patient_num = PatientAppointments.patient_num)
AS Query3
ON (DoctorSchedule.appt_time = Query3.appt_time)
AND (DoctorSchedule.calendar_date = Query3.calendar_date)
AND (DoctorSchedule.doctor_num = Query3.doctor_num))
ON Doctors.doctor_num = DoctorSchedule.doctor_num
WHERE (((DoctorSchedule.calendar_date) BETWEEN #5/1/2009 # AND #5/7/2009 #))
GROUP BY Doctors.doctor_name,DoctorSchedule.calendar_date
PIVOT DoctorSchedule.appt_time;
 
K

KARL DEWEY

You wil just have to try posting to this forum as I do not give anyone my
e-mail address.

Mynor said:
Hi Karl:

Thanks for taking the time to help me. If possible I would like to send you
a picture of what I need to create. I try to post it to the forum but I
don't think that is possible. I am sure that if you see the display it will
make more sense. I have not physically try your suggestion but I looked at
you SQL statement and it does not seem to me that it will give me the result
I am looking for. Please you can write to (e-mail address removed) if you don't
want to post you e-mail address for everyone to see.

Thanks

KARL DEWEY said:
Here is a start that has problems. You will always need to start and end on
half hour.
Create a table name CountNumber with field CountNUM containing numbers from
0 (zero) through your maximum.

RoomReservePeriods --
SELECT DateAdd("n",[CountNUM]*30,[starttime]) AS Room_Periods
FROM Reservations, CountNumber
WHERE (((DateAdd("n",[CountNUM]*30,[starttime]))<[endtime]))
GROUP BY DateAdd("n",[CountNUM]*30,[starttime]);

TRANSFORM First([FirstName] & " " & [LastName]) AS Expr1
SELECT Rooms.roomname
FROM RoomReservePeriods, (Rooms INNER JOIN Reservations ON Rooms.Roomid =
Reservations.roomid) INNER JOIN USERS ON Reservations.userid = USERS.userid
WHERE (((RoomReservePeriods.Room_Periods) Between [starttime] And [endtime]))
GROUP BY Rooms.roomname
PIVOT RoomReservePeriods.Room_Periods;


Mynor said:
Hi Karl:
I also have the feeling that it should be a cross tab. I have the following
tables:

Rooms:
Roomid
roomname
location
capacity

Users:
userid
FirstName
LastName
Position

Reservations:
Reservationid
roomid
userid
date
starttime
endtime
comments

I also created a table with all the available hours from 8:00 AM to 7:00 PM
in 30 minutes increments to try to use it as the column headers for the cross
tab but it does not work. Please let me know if you find that I am missing
something or if you have any ideas on how to go about it.

Thanks

:

I have all the information in tables but this display is just killing me.
Sounds like a job for crosstab query but without knowing table structure it
is hard to guess.


:

Hello:

I am trying to create a meeting room booking database. I have been asked to
display a grid by day of the available and used time slots. I have tried so
many things but nothing displays the data the way I need. I need for the
available hours in the day to display at the top and the list of meeting
rooms on the left and then show what meeting room is being used during the
day. I have all the information in tables but this display is just killing
me. Any ideas or suggestion on what to use???


Thanks
 
F

Fred

Here's the low tech Fred idea.

Turn your desired display sideways and make that your main table. The
fields are the rooms, and the time slots are the records. If the booking
info is short, just put it in the field. If the booking info is long, make a
bookings table with PK BookngID and put that number into the field in your
main table.

You can select the time span for your display. You can even group the time
slots by day and week. This violates normalization rules, but,what the
heck, it's a mission not a religion.
 

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