FindFirstElement fails

Hi,

I have a form with a rich text field where I want to attach a table. Since the table has to have specific features, what I do is that I have a table with one row and all the settings I want in a profile document and from the form I use AppendRTItem to copy the table to my rich text field. I’m able to copy the table to the field but I also want to put a time stamp to the first column of the only row in the table but my code never finds the table when I try to use FindFirstElement. This is a piece of the code I wrote:

'tablefield is the table from my profile document

Call rtitem.AppendRTItem( tableField )

Call rtitem.Update

Set rtnav = rtitem.CreateNavigator

'After I append the table, I look for it in the field and I don’t see it, so the If statement is not executed.

If rtnav.FindFirstElement(RTELEM_TYPE_TABLE) Then

Set rtt = rtnav.GetElement

flag = rtnav.FindNthElement(RTELEM_TYPE_TABLECELL,1)

'Now I'm positioned on the first column of the last row

Call currentTime.SetNow

timeOnly = currentTime.TimeOnly

militaryTime = Cstr(Format$(timeOnly,"h:mm:ss"))

Call rtitem.BeginInsert(rtnav)

richStyle.Bold = True

Call rtitem.AppendStyle(richStyle)

Call rtitem.AppendText(militaryTime)

richStyle.NotesColor = COLOR_Black

richStyle.Bold = False

Call rtitem.AppendStyle(richStyle)

Call rtitem.EndInsert

flag = rtnav.FindNthElement(RTELEM_TYPE_TABLECELL,2)

End If

The line where I’m having the problem is:

If rtnav.FindFirstElement(RTELEM_TYPE_TABLE)

because after I append the table, I try to look for it with the IF statement and the if fails.

I appreciate any help!

Subject: FindFirstElement fails

Let me guess… is the rich text field inside a table cell on the form? If so, the FindFirstElement will fail as Notes does not support nested tables in the NotesRichText classes.

Subject: RE: FindFirstElement fails

Actually the rich text field is not on a table. My problem is that after I append the rich text item (which is a table) to the other rich text item, the FindFirstElement doesn’t show that there’s anything in the rich text field.