Hi,
This piece of code retrieves values from a document and then places them in a members field of a group document in an address book...the group documents have been pre-created in the address book but the problems i am having is that i need to do the while loop, populate a temporary document and then compare that with the current group document...but i am falling over with my append or replaceitemvalue statement....can someone id where i am going wrong..or has similar code
i have stated in my code below:
'PROBLEMS HERE
tempgroup1doc.Members = ""
i am using the for i = 1 to 6 incorrectly ?
My code:
Sub Initialize
'Main code:
'Declarations
Set v = db.getview("DivisionsV")
Dim pabview As NotesView
Set pabview = PABdb2.GetView ( "Groups" )
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Set Unidoc = v.getfirstdocument
count = 0
Dim TAllACPO() As String
Dim i As Integer
Do Until Unidoc Is Nothing
If unidoc.DivName(0) = "Ghost" Then
Exit Sub
End If
'Processing here
Call ACOMember
Set Unidoc = v.getnextdocument(Unidoc)
count = count + 1
Print count
Loop
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Else
Msgbox "nab isn't open"
End If
Call SiteDivAllStaffMembers
Call SiteTeamAllStaffMembers
'END OF MAIN CODE
End Sub
6666666666666666666666666666666666666
Sub ACOMember
Dim s As New notessession
Dim p As Variant
Dim q As Variant
Dim u As Variant
Dim y As Variant
' Dim i As Integer
Group(1) = "All ACOs"
Group(2) = Unidoc.DivName(0) & " ACOs"
Group(3) = Unidoc.DivName(0) & " DMT"
Group(4) = "AST"
Group(5) = Unidoc.DivName(0) & " All Staff"
Group(6) = "All Probation Grade Staff"
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
p = unidoc.DivACPO
For i = 0 To Ubound(p)
If i = 0 Then Redim q(i)
If i > 0 Then Redim Preserve q(i)
If p(i) = "" Then
q(i) = ""
Else
q(i) = p(i) & "/WestMidlands/NPS"
End If
Next
y = q ' eg.... y = Pat Royal/WestMidlands/NPS
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dim pabview As NotesView
Set pabview = PABdb2.GetView ( "Groups" )
For i = 1 To 6
'current
Set group1doc = pabview.getdocumentbykey(Group(i))
Set group1members = group1doc.Getfirstitem("Members")
'new
Set tempgroup1doc = pabdb2.createdocument
tempgroup1doc.Form = "Group"
tempgroupmembers = group1doc.Members
'+++++++++
'PROBLEMS HERE
tempgroup1doc.Members = ""
'+++++++++
tempgroup1doc.ListName = Group(i) & "TG" ' TG = Temporary Group
tempgroup1doc.Type = "Group"
Set tempgroup1members = tempgroup1doc.GetFirstItem("Members2")
For x = 0 To Ubound(y)
Call tempgroup1members.AppendToTextList ( y(x) )
Next
Call tempgroup1doc.Save(True, False)
Call pabview.Refresh
Set group1doc = pabview.getdocumentbykey(Group(i))
Set tempgroup1doc = pabview.getdocumentbykey(Group(i) & "TG")
Dim groupmemberitem As NotesItem
Dim tempmemberitem As NotesItem
Dim text1 As String
Dim text2 As String
Set groupmemberitem = group1doc.GetFirstItem("Members")
Set tempmemberitem = tempgroup1doc.GetFirstItem("Members2")
text1 = groupmemberitem.Text
text2 = tempmemberitem.Text
If text1 <> text2 Then
Set group1members = group1doc.ReplaceItemValue("Members",tempgroup1doc.members)
Call group1doc.Save(True, True)
Call tempgroup1doc.Remove(True)
Else
' Print Group(i) & " list is still the same, wont save document"
Call tempgroup1doc.Remove(True)
End If
Next
End Sub

Append or Replace (Nadeem Shaikh 25.Jan.04)
. . 