Calendar check button

Hi all,

I have created a calendar check button, this button check if a meeting has been scheduled on the current Lotus Notes Calendar, the button is on the CRM

Please find the code below:Sub Click(Source As Button)

Dim s As  NotesSession

Dim db As NotesDatabase

Dim dc As NotesDocumentCollection

Dim view As NotesView

Dim doc As notesdocument





Set s = New NotesSession

Set db = s.GetDatabase("","")

Set view =db.GetView( "lookupCalendarDates")

Set dc = view.GetAllDocumentsByKey(Today)



If Not (dc Is Nothing) Then

	Set doc = view.GetFirstDocument

	If(StartTime >= EndTime) And (EndTime <= StartTime) Then

		Msgbox "Calendar Time cannot be booked"

	Else

		If  (EndTime >= StartTime)  And (StartTime <= EndTime) Then

			Msgbox "Calendar Time is booked" 

			Exit Sub

		End If

	End If

	

End If

End Sub

what this code does it get to the first if statement and does not loop to the second statement to check if the time is available or not

Your assistance will be appreciated

Ta

Subject: Calendar check button

you need to loop through the collection, not the view.

set doc = dc.getfirstdocument

while not doc is nothing

do your stuff here

set doc = dc.getnextdocument(doc)

Subject: RE: Calendar check button

Hi Paul,

Thank you for the suggetion I tried it, and it still didn’t give me an output.

Right now I’m trying to use the calendar check code that is used on the Mail template, but it gives me the following error: Invalid or non existent document.

Please look at the code below one is the R7 version and the other is an R8 Version.

R7:

DateToGoto := @If(@IsAvailable(NewStartDate);@TimeMerge(NewStartDate; NewStartTime;NewStartTimeZone);

		@IsAvailable(StartDateTime);StartDateTime;

		@IsAvailable(DueDateTime);DueDateTime;

		@Today);

@Command([CheckCalendar];DateToGoto)

R8:

tmpIndex := @Member(@Text(StartDate;“D0S0”);@Text(StartDateTime;“D0S0”));

DateToGoto := @If(@IsAvailable(NewStartDate);@TimeMerge(NewStartDate; NewStartTime;NewStartTimeZone);

		@IsAvailable(OrgRepeat) & @Elements(StartDateTime) > 1; StartDateTime[@If(tmpindex = 0;1;tmpindex)];

@IsAvailable(StartDateTime);StartDateTime;

		@IsAvailable(DueDateTime);DueDateTime;

		@Today);

@Command([CheckCalendar];DateToGoto),

any assistance will be appreciated.

Subject: RE: Calendar check button

I know this response is really late, but in case it helps others searching for this.

@Command([CheckCalendar]… is looking for a calendar view in the database, and it is expected to be called ($Calendar)|Calendar.