I'm a bit concerned when you say that your query is one table. I hope that
you mean one table which is linked to others (growing gloomy)
The way I've done this is to have
a TimeSlot table which contains a primary key, a sequential number key
(which isn't an autonumber and all the 1/2 hourly time
slots potentially available on any one day with SlotStart as eg 09:00 and
SlotEnd as 09:30
A Date table with the Fields
DateID
and WDate (not just Date of course)
where I add the dates for which i want to make a report (You could add all
the dates for the year if you wish using code or certainly for a month at a
time)
I also have a Worker table with WorkerID and eg WorkerSurname
And finally a Worker TimeSlot table.
which has
WorkTimeID (Primary Key)
DateID
TimeSlotID
WorkerID
AppointDetails (the text field with the details)
This table has an Index in its Design so that DateID+TimeSlotID+WorkerID is
unique. This prevents double bookings so that when a new worker joins, I can
run the query again and the time slots won't be added again the workers who
are already there.
All the Workers, Dates, Timeslots are added to my WorkerTimeSlot table by
simply having an Append query. In this, The Worker table, Date Table and
Time slot table are all unlinked so that every time slot, every day and
every worker are listed. The Unique Index ensures that no combination is
listed twice.
Base your main Report on a query based on your appointments table, Add the
Worker, and Date fields to it.
Group it first by Date then DateID , giving this latter field a footer in
the Sorting/Grouping box. You get set the Force New page Property to After
Section
Then group by Worker and WorkerID, giving this section a header and footer.
Again Force New Page after the footer. Put the Date and Worker Name details
in this Header.
Now group by Time Slot Number giving it a header where you will put the Time
Slot and AppointDetails and a footer, choosing Force New page After section.
This will give you your 1 page per appointment.
There will be nothing in the Details section.
For your subreport, copy and paste the query you used for your main report
but have the Criteria Is Not Null under your Appointment Details field to
filter out the blank appointments.
It needs the WorkerID field and the DateID field, the SlotId, Timeslot and
Appointment details
Your subform can sorted in the Sorting Grouping box by TimeSlot SortNumber
Make the id fields invisible so that only the TimeSlot and AppointDetails
show.
In Design View, slide the subreport into the WorkerID header in your Main
Report
In Properties, on the Data Tab, link this to your main report by *both*
Worker ID and Day ID using the Link Master Key and Link Child Key
Please ask if any of this is not clear.
Evi