EndInsert Causes Crash

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

Subject: EndInsert Causes Crash

Hi

Can you post the FATAL THREAD section of the NSD files with the few lines under it

For example:

############################################################

FATAL THREAD 1/2 [ domdsm:107a8:67076]

FP=0x0012a34c, PC=0x60069a86, SP=0x0012a2f0, stksize=92

EAX=0x01a3088c, EBX=0x01a48650, ECX=0x0000bffe, EDX=0x01a325e6

ESI=0x00004000, EDI=0x0032ff78, CS=0x0000001b, SS=0x00000023

DS=0x00000023, ES=0x00000023, FS=0x0000003b, GS=0x00000000 Flags=0x00010206

Exception code: c0000005 (ACCESS_VIOLATION)

############################################################

@[ 1] 0x60069a86 nnotes._fdDelete@4+118 (4000,12a368,608770ef,4000)

@[ 2] 0x60069a0c nnotes._OSFileClose@4+12 (4000,12adc0,12a380,60872ea7)

@[ 3] 0x608770ef nnotes._sqloclose+15 (4000,12b59c,5010,0)

@[ 4] 0x60872ea7 nnotes._sqlpgclf+71 (12adc0,1aaa2cb,70,1aaa2f3)

@[ 5] 0x60885458 nnotes._sqlpgfdl+616 (12b9a4,1aaa2cb,41,12be44)

@[ 6] 0x60876a6f nnotes._sqlpgcdl+927 (12bf44,12b9a4,0,12be44).

Date

Topic

Frequently asked question - How to analyze Notes/Domino NSDs? (Jean-Yves Riverin)

or call IBM support.

JYR

Subject: RE: EndInsert Causes Crash

Thanks JYR,

I actually pulled a copy of the same db, restarted my domino server then put a new copy back on it, and everything seems to be working fine now. Not sure exactly what fixed it, but at least its working.