Good morning, My problem is how to use array correct. I have a form with a “repeat” field, “repeat” field contains a text list, such as “15/12/2006”,“16/12/2006”,“17/12/2006”. I would like to create new documents based on the repeat field. in this case, I want to create 3 documents as the repeat field contains 3 list.
the code below does not work, I know there are some problems with the repeat field, but I don’t know how to fix it.
Dim session As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim ndoc As NotesDocument
Set db = session.CurrentDatabase
Set doc = Source.document
If Ubound(Source.Document.repeat(0))>1 Then
For i=1 To Ubound(Source.Document.repeat(0))
Set ndoc=db.CreateDocument
ndoc.form="Reservation"
ndoc.ReservedBy=doc.ReservedBy(0)
ndoc.sDate=doc.repeate(i)
ndoc.eDate=""
ndoc.ResourceName=doc.ResourceName(0)
ndoc.Description=doc.Description(0)
Call ndoc.Save( False, True )
Next
End If
BTW, your code before looks fine. The bug appears to be that you started your array reference at 1 instead of 0 (assuming the you don’t have Option Base 1 declared).
Anyhow, I think that the ForAll approach is superior, IMHO.