![]() ![]() ![]() ![]() Gravitybox Schedule Primer
Page 57
1998-2004 Gravitybox Software LLC
Private Sub LoadSchedule()
'This procedure Loads a Schedule from the database
'and populates this form. This method assumes a
'database with a table named tbl_Schedule and
'also a schedule control named Schedule1
Dim Db As ADODB.Connection
Dim rs As ADODB.Recordset
'Load this day's information from the Database
Set Db = New ADODB.Connection
Db.ConnectionString = GetConnectString & _
AppPath & "schedule.mdb"
Call Db.Open
Set rs = New ADODB.Recordset
Set rs = Db.Execute("select * from tbl_Schedule where
StartDate = #1/1/2002#")
'Loop through and display all the appointments
While Not rs.EOF
Call Me.Schedule1.ScheduleItems.Add("", _
#1/1/2002#, rs!RoomName, _
rs!StartTime, rs!Length, _
rs!Description, rs!CategoryName & "")
Call rs.MoveNext
Wend
End Sub
This code will load the all of the appointments that have been scheduled for this
particular date.
Before the appointments are loaded, there is code to load the rooms and
categories of the schedule. This is necessary for the schedule is display correctly, of
course. The rooms are loaded from the database where they have been previously
setup from the room configuration screen. That screen allows the user to specify a
number of rooms and a name for each.
Private Sub LoadRooms()
'This procedure Loads a Schedule from the database
Dim Db As ADODB.Connection
Dim rs As ADODB.Recordset
Dim objRoom As CRoomEl
|