I am creating a travel/vacation db- the vacation part works flawlessly- I am attempting to dynamically create a table in the existing (on screen) document that will have as many rows as there are days in the field “DateRange”. I took the code from the help database where, in fact, it works from a view button. I have modified it to a button on the form after the field DateRange. The debugger shows no errors- but the table doesn’t show- if I save and close and reopen it- it still doesn’t show. At the moment, I just want it to make the table w/ the right number of rows (The date range field works off of a StartDate & EndDate field which explodes the dates inbetween) I know I am missing something simple-- the commented out lines were the original attempt-
Dim session As New NotesSession
Dim ws As New NotesUIWorkspace
Dim db As NotesDatabase
Set db = session.CurrentDatabase
REM Create document with Body rich text item
'dim doc As New NotesDocument(db)
Dim uidoc As NotesUIDocument
Set uidoc = ws.CurrentDocument
Dim Doc As NotesDocument
Set Doc = uidoc.Document
Dim Body As String
'Dim RTItem As NotesRichTextItem
Set richbody = New NotesRichTextItem(Doc,"body")
'Dim Body As New NotesRichTextItem(doc, "Body")
REM Create table in Body item
Dim MyRowCount As Variant
MyRowCount=doc.DateRange
Dim GetRowCount As Integer
GetRowCount = Ubound(MyRowCount) + 1
rowCount% = GetRowCount
columnCount% = 3
Call Richbody.AppendTable(rowCount%, columnCount%)
REM Populate table
Dim rtnav As NotesRichTextNavigator
Set rtnav = Richbody.CreateNavigator
Call rtnav.FindFirstElement(RTELEM_TYPE_TABLECELL)
For iRow% = 1 To 4 Step 1
For iColumn% = 1 To 3 Step 1
Call Richbody.BeginInsert(rtnav)
Call Richbody.AppendText("Row " & iRow% & ", Column " & iColumn%)
Call Richbody.EndInsert
Call rtnav.FindNextElement(RTELEM_TYPE_TABLECELL)
Next
Next
Call doc.Save(True,True)
TIA
Tom