How to force refresh on backend doc so richtext can be seen?

Hi,

I took this example from Lotus Domino Designer 7 Help to get a rowcount of a table in a “Body” richtext field of “Memo” mail database. It works on detecting the existence of a table but the rowcount for that table is not working. If I edit and save that mail then the rowcount works.


Sub Initialize

Dim session As New NotesSession

Dim db As NotesDatabase

Set db = session.CurrentDatabase

Dim dc As NotesDocumentCollection

Set dc = db.UnprocessedDocuments

Dim doc As NotesDocument

Set doc = dc.GetFirstDocument

totalrow = 0

Dim rti As NotesRichTextItem

Set rti = doc.GetFirstItem("Body")

Dim rtnav As NotesRichTextNavigator

Set rtnav = rti.CreateNavigator

If Not rtnav.FindFirstElement(RTELEM_TYPE_TABLE) Then

	Messagebox "Body item does not contain a table",, "Error"

	Exit Sub

End If

Dim rtt As NotesRichTextTable

Call doc.Save(True,True)

Set rtt = rtnav.GetElement

Dim rowcount As Integer

rowcount = 0

rowcount = rtt.RowCount

Msgbox rowcount,,"Rowcount"

End Sub


What do I need to do to"refresh" this backend doc so the rowcount for the table can be seen?

Many thanks in advance for your help or suggestions.

Subject: How to force refresh on backend doc so richtext can be seen?

Help, please. I am designing an agent “Before new mail arrives” that intercepts mail with specific subject, read table in the richtext “Body” field. If data on few selected rows meet certain criteria, I copy them to an array. I will then compose a new Memo, create a table, populate with data from that array then send that new mail.

I tested it as an action button by selecting certain mails in the Inbox. It works if I edit then save those selected mails. If not it fails on the attempt to read the row count. So, somehow, I have to refresh those mails in order for the above code to read that table. Somehow the code works on detecting the existence or non existence of a table but can not read row count, let alone read data inside that table.

Many thanks for suggestions or help. I have tried thru out last weekend but could not come up with anything working.

Again, thanks for any help.