I have a form which has 20 fields in it. The fields are called CR1, CR2, CR3 and so on. the field is a dialog box.
Now what I would like to do is get the value of that field and if the value is “01”(string) on the current document change it to “02” on the new document that I created within LS. If I hard code it like doc.CR1(0) = “01” then adoc.CR1 = “02” it works but I would like to use an array. Is it possible? Here is my code:
Dim session As New NotesSession
Dim ws As New Notesuiworkspace
Dim db As NotesDatabase
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Dim adoc As NotesDocument
Dim crdr As String
Set db = session.CurrentDatabase
Set uidoc = ws.CurrentDocument
Set doc = uidoc.Document
Call uidoc.Refresh
Call uidoc.Save
Set doc = uidoc.Document
If doc.types(0) = “RevAccrual” Then
Set adoc = db.CreateDocument
adoc.Form = "BookingsR"
Call doc.CopyAllItems(adoc)
For arraycount = 1 To 2
typcd = "CrDr" & arraycount
crdr = uidoc.FieldGetText(typcd)
If crdr = "01" Then
adoc.crdr = "02"
Elseif crdr = "02" Then
adoc.typcd = "01"
End If
Next
'This is what works now
’ If doc.CrDr1(0) = “01” Then
’ adoc.CrDr1 = “02”
’ Elseif doc.CrDr1(0) = “02” Then
’ adoc.CrDr1 = “01”
’ End If
’ If doc.CrDr2(0) = “01” Then
’ adoc.CrDr2 = “02”
’ Elseif doc.CrDr2(0) = “02” Then
’ adoc.CrDr2 = “01”
’ End If
’ and so on for the next 20 fields
Call adoc.ComputeWithForm(False, False)
Call ws.editdocument(True, adoc)
End If
Call uidoc.Close
End Sub
Any suggestions would be appreciated.
Thanks