![]() |
SQL Server Events |
Post Reply ![]() |
Author | |
jcollier ![]() Senior Member ![]() Joined: 15 February 2006 Status: Offline Points: 250 |
![]() ![]() ![]() ![]() ![]() Posted: 12 July 2006 at 3:56pm |
Ok, I'm probably just old, tired and slow but I am having an extremely difficult time getting the Calendar to connect to a SQL Server 2000 database and then populate the events.
Does anyone have a function or small sample that they could share? Thanks! |
|
![]() |
|
jcollier ![]() Senior Member ![]() Joined: 15 February 2006 Status: Offline Points: 250 |
![]() ![]() ![]() ![]() ![]() |
Maybe I should give more explanation of what I am trying to do.
I have 2 tables in a sql server database. One for employees and one for days they request to have off for any number of reasons (Vacation, Personal, Sick, Jury Duty, etc...) I just want a person to be able to fill out a form with the reason of the request from a combo box, a start date and an end date. I have that data being stored in the database with no problem. The problem comes with trying to get the event to display on the calendar. It seems that, unless I am missing something which I probably am, it is more complicated than it needs to be. Sorry to sound cranky. One of those days. Thanks! |
|
![]() |
|
jcollier ![]() Senior Member ![]() Joined: 15 February 2006 Status: Offline Points: 250 |
![]() ![]() ![]() ![]() ![]() |
Ok. After some sleep and some time not thinking about it at all, I took another look and figured it out enough to get done what I need. It's actually pretty simple.
With rsDays .Open sql, db, adOpenForwardOnly, adLockReadOnly Do While Not .EOF Set NewEvent = Calendar.DataProvider.CreateEvent NewEvent.StartTime = CDate(!StartDate) NewEvent.EndTime = DateAdd("d", 1, CDate(!EndDate)) NewEvent.AllDayEvent = True NewEvent.Label = !RequestTypeID NewEvent.Subject = !FirstName & " " & !LastName & "-" & !RequestType NewEvent.Body = !FirstName & " " & !LastName & "-" & !RequestType 'NewEvent.ReminderSoundFile = ".." Calendar.DataProvider.AddEvent NewEvent Calendar.Populate .MoveNext Loop .Close End With |
|
![]() |
|
sserge ![]() Moderator Group ![]() Joined: 01 December 2004 Status: Offline Points: 1297 |
![]() ![]() ![]() ![]() ![]() |
I'd also suggest to change this piece of code by calling Calendar.Populate at the end of the loop to avoid some overhead calculations.
-- WBR, Serge |
|
![]() |
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 |