Why when doc save ,this code just run once doc,help me fix it. Thanks a lot for help
Code:
While Not (doc Is Nothing)
If doc.count(0) = 1 Then
For l%=1 To 30
num$=Trim(CStr(l%))
If Trim(doc.getitemvalue("item"+num$)(0))="" Then Exit For
i1=Format$(Now,"YYYYMMDD")
i2=Format$(Now,"hhmmss")
i3=Trim(doc.phone(0))
i4=Trim(doc.getitemvalue("item"+num$)(0))
print i1+i2+i3+i4
Next
End If
doc.count = 2
doc.Save( True, True )
Set doc=v.getnextdocument(doc)
Wend
Print:
2022102433phone1item1
2022102433phone1item2
2022102433phone1item3
Code:
While Not (doc Is Nothing)
If doc.count(0) = 1 Then
For l%=1 To 30
num$=Trim(CStr(l%))
If Trim(doc.getitemvalue("item"+num$)(0))="" Then Exit For
i1=Format$(Now,"YYYYMMDD")
i2=Format$(Now,"hhmmss")
i3=Trim(doc.phone(0))
i4=Trim(doc.getitemvalue("item"+num$)(0))
print i1+i2+i3+i4
Next
End If
Set doc=v.getnextdocument(doc)
Wend
Print:
2022102433phone1item1
2022102433phone1item2
2022102433phone1item3
2022102433phone2item1
2022102433phone2item2
2022102433phone2item3
2022102433phone3item1
2022102433phone3item2
2022102433phone3item3
Check the view selection formula. Does it depend on the field CCount
. If the save changes values on the document, the document may be removed from the view. If this is the case, change the code to:
Dim doc2 As NotesDocument
While Not (doc Is Nothing)
If doc.count(0) = 1 Then
For l%=1 To 30
num$=Trim(CStr(l%))
If Trim(doc.getitemvalue("item"+num$)(0))="" Then
Exit For
End If
i1=Format$(Now,"YYYYMMDD")
i2=Format$(Now,"hhmmss")
i3=Trim(doc.phone(0))
i4=Trim(doc.getitemvalue("item"+num$)(0))
Print i1+i2+i3+i4
Next
End If
doc.ccount = 2
Set doc2 = v.getnextDocument(doc)
Call doc.Save( True, True )
Set doc=doc2
Wend