Hi All,
I am trying to find out what I have done wrong with my Lotusscript, I have a button that when pressed searches the database for documents that match a date value after it finds a document match, the agent creates a Memo with a table and document information. The problem I am having is the EndInsert every time I press the button it crashes Notes and Designer. I have narrowed it down to the EndInsert line but can’t find anything that I am doing wrong in my code. Thanks for the help
Sub Click(Source As Button)
Dim s As New NotesSession
Dim db As NotesDatabase
Dim dc As NotesDocumentCollection
Dim doc As NotesDocument
Dim whenNow As String
whenNow$ = Today() + 1
Dim eNote As String
Dim eName As String
Dim eDate As String
Dim eLocation As String
Dim eRoom As String
Dim eTime As String
Set db = s.CurrentDatabase
Dim rtitem As NotesRichTextItem
Dim mail As New NotesDocument(db)
Dim body As New NotesRichTextItem(mail, “Body”)
Set db = s.CurrentDatabase
Set dc = db.AllDocuments
Set doc = dc.GetFirstDocument
Do While Not(doc Is Nothing)
If doc.Form(0) = “CLReg” Then
If Not doc.Status(0) = “4” Then
If doc.Date(0) = whenNow$ Then
'********** start get activity information
eNote = doc.CLName(0)
eName = doc.CLName(0)
eDate = doc.Session1View(0)
eLocation = doc.Location(0)
eRoom = doc.Room1(0)
eTime = doc.Time(0)
'****************** End get activity information
'****************** Memo Section
mail.Principal = “Training Memo”
mail.form = “Memo”
Dim richStyle As NotesRichTextStyle
Set richStyle = s.CreateRichTextStyle
mail.sendTo = s.UserName
mail.subject = “Training Session Reminder”
richStyle.Bold = True
richStyle.NotesColor = COLOR_Blue
Call body.AppendStyle(richStyle)
Call body.AppendText("Training Reminder Email! ")
richStyle.Bold = False
richStyle.NotesColor = COLOR_Black
Call body.AppendStyle(richStyle)
Call body.AddNewLine ( 2 ,True )
Call body.AppendText(“Hello”)
Call body.AddNewLine ( 2 ,True )
Call body.AppendText("You are recieving this e-mail as a reminder of your enrollment in the ")
richStyle.Bold = True
Call body.AppendStyle(richStyle)
Call body.AppendText(eName)
richStyle.Bold = False
Call body.AppendStyle(richStyle)
Call body.AppendText(". Your class information is listed below. ")
Call body.AddNewLine ( 2 ,True )
Call body.AppendText(eNote)
Call body.AddNewLine ( 2 ,True )
Call body.AppendText(“Please ensure you have it on your calendar”)
Call body.AddNewLine ( 2 ,True )
'**************************************
REM Create table in Body item
rowCount% = 1
columnCount% = 4
Call body.AppendTable(rowCount%, columnCount%)
REM Populate table
Dim rtnav As NotesRichTextNavigator
Set rtnav = body.CreateNavigator
Call rtnav.FindFirstElement(RTELEM_TYPE_TABLECELL)
For iRow% = 1 To 1 Step 1
For iColumn% = 1 To 4 Step 1
If iRow% = 1 And iColumn% = 1 Then
Call body.BeginInsert(rtnav)
Call body.AppendText(“Date”)
‘**** crash happens here’
Call body.EndInsert
'*********************
Call rtnav.FindNextElement(RTELEM_TYPE_TABLECELL)
End If
If iRow% = 1 And iColumn% = 2 Then
Call body.BeginInsert(rtnav)
Call body.AppendText(“Location”)
Call body.EndInsert
Call rtnav.FindNextElement(RTELEM_TYPE_TABLECELL)
End If
If iRow% = 1 And iColumn% = 3 Then
Call body.BeginInsert(rtnav)
Call body.AppendText(“Time”)
Call body.EndInsert
Call rtnav.FindNextElement(RTELEM_TYPE_TABLECELL)
End If
If iRow% = 1 And iColumn% = 4 Then
Call body.BeginInsert(rtnav)
Call body.AppendText(“Room”)
Call body.EndInsert
Call rtnav.FindNextElement(RTELEM_TYPE_TABLECELL)
End If
Next
Next
Call mail.Send(False)
'********* End Memo Section
End If
End If
End If
Set doc = dc.GetNextDocument(doc)
Loop
End Sub