View Single Post
  #2 (permalink)  
Old May 2nd, 2006, 03:56 PM
kindler kindler is offline
Friend of Wrox
 
Join Date: Dec 2005
Location: , , .
Posts: 142
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Here's a way you can show your bookings and prevent double bookings. Create a table for bookings with the Date, Session (Morning/Afternoon/Evening using a Value List lookup), and Party identifier. Set the primary key for that table to be Date & Session. That prevents anyone from booking the same date/session if it's already there. Create a form that contains Calendar Control and a subform bound to the bookings table. Open up VBE (Alt-F11) and put the following code in the file for that form:

Private Sub Calendar0_Click()
Me.Bookings_subform.Form.RecordSource = "SELECT Date, Session, Party FROM Bookings WHERE Date = #" & Me.Calendar0.Value & "#;"
Me.Bookings_subform.Requery
End Sub

Edit any of the control names to match what you have. That will show what bookings are on a given day, and allow you to add new ones that don't conflict with existing ones. You can play around with code and appearance to make the interface according to your own desires at this point, whether you want to have a form that has an Option Group of the Sessions and disable the sessions on a given date, or what not. I'd really need more specifications before going into any further design.

Reply With Quote