Multiple resource problem |
Post Reply |
Author | |
scbdpm
Groupie Joined: 05 January 2007 Status: Offline Points: 15 |
Post Options
Thanks(0)
Posted: 06 January 2007 at 4:53pm |
I have the code below which loads my resources ('Schedules') and Events/appointments from my Access DB wonderfully!
However, it appears to be 'shifted'. What I mean by that is the the same appointments are showing in the first two columns (i.e. resources) and then the appointments that are supposed to be in the second column is in the third and so on......
Here is code:
Public Sub LoadSchedule(dtNewDate As Date)
Dim arResources As New CalendarResources Dim pRes0 As New CalendarResource Dim pRes1 As New CalendarResource pRes0.SetDataProvider2 "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\Data\Events.mdb", True If pRes0.DataProvider Is Nothing Then Debug.Assert False Exit Sub End If If Not pRes0.DataProvider.Open Then If Not pRes0.DataProvider.Create Then Debug.Assert False Exit Sub End If End If '// ** schedules Dim pSchedules As CalendarSchedules Set pSchedules = pRes0.DataProvider.Schedules If pSchedules Is Nothing Then Exit Sub End If '// ** resources pRes0.Name = pSchedules.Item(0).Name pRes0.ScheduleIDs.Add pSchedules.Item(0).Id arResources.Add pRes0
pRes1.SetDataProvider pRes0.DataProvider, False Dim ldx As Integer For ldx = 1 To pSchedules.Count - 1 'changed Ubound(sarray) Set pRes1 = New CalendarResource pRes1.Name = pSchedules.Item(ldx).Name ' sArray(ldx) pRes1.ScheduleIDs.Add ldx ' set data provider from first resource pRes1.SetDataProvider pRes0.DataProvider, True arResources.Add pRes1 Next CalendarControl.SetMultipleResources arResources CalendarControl.ActiveView.DayHeaderFormatLong = "mm/dd/yyyy" CalendarControl.Populate CalendarControl.DayView.ShowDays dtNewDate, dtNewDate
End Sub |
|
sserge
Moderator Group Joined: 01 December 2004 Status: Offline Points: 1297 |
Post Options
Thanks(0)
|
Look below for the fixed code:
-- WBR, Serge |
|
scbdpm
Groupie Joined: 05 January 2007 Status: Offline Points: 15 |
Post Options
Thanks(0)
|
worked like a charm!
thanks for the changes!!!!!!
|
|
lexicon
Groupie Joined: 26 January 2007 Status: Offline Points: 46 |
Post Options
Thanks(0)
|
I wrote the code to make a multiple schedule calendar and i added 2 schedules
When i'm adding a event in schedule 1 then it appears and in schedule 2
but, when i'm addind a event to schedule 2 then it appears only in schedule 2
Tha data in database is correct but the display of them is wrong
What i'm doing wrong?
|
|
sserge
Moderator Group Joined: 01 December 2004 Status: Offline Points: 1297 |
Post Options
Thanks(0)
|
Most likely you incorrectly configured Resources. Your first resource looks to contain both schedule 1 and schedule 2, but it should contain only schedule 1.
-- WBR, Serge |
|
lexicon
Groupie Joined: 26 January 2007 Status: Offline Points: 46 |
Post Options
Thanks(0)
|
I have 4 rooms and when i'm adding events for each one the data in access db shows correctly the field scheduleID as 1,2,3,4 correct
But in Calendar displays all 4 events for everyone
Sorry I'm new here, How to configure resources?
I'm using the example on your code without any modifications, only i change the dataprovider for the nultischedule from .xml to .mdb
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |