Hi,
I have the following code below which runs through a view, gets documents based on a key and retrieves some field values
but my problem is that when i run debugger and get to the line
Set teamdoc = dc.GetNextDocument( teamdoc)
item is then set to blank, so when the debugger gets to the line
If Not (item Is Nothing) Then
it goes to the end if statement....
In my code i am trying to get hold of field values for TeaSPO, TeaPO, TeaPSO and TeaTPO for all the documents in the colection (dc).
Is there a better way of doing this within my code.
Please help
Thanks
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Sub SiteAllStaffGroups
Dim s As New notessession
Set Agent = s.currentAgent
AgentName = Agent.Name
groupList("Bilston Hostel All Staff") = ""
groupList("Birmingham Prison All Staff") = ""
groupList("Bishop Street All Staff") = ""
Dim item As NotesItem
Set v = Unicorndb.getview("SitesV")
Set sitedoc=v.GetFirstDocument
count = 0
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Do Until sitedoc Is Nothing
Dim teamview As NotesView
Set teamview = UnicornDb.GetView ( "AllLiveTeamsBySiteV" )
Dim dc As NotesDocumentCollection
Set dc = teamview.GetAllDocumentsByKey(sitedoc.SitName(0), True)
Set teamdoc = dc.GetFirstDocument
Do Until teamdoc Is Nothing
'for each team in this colloection get the following fields and store them - spo, po, pso, tpo
Set item = teamdoc.getFirstItem("TeaSPO")
Call item.AppendToTextList (teamdoc.TeaPO )
Call item.AppendToTextList (teamdoc.TeaPSO )
Call item.AppendToTextList (teamdoc.TeaTPO )
Set teamdoc = dc.GetNextDocument( teamdoc)
Loop
If Not (item Is Nothing) Then
Forall h In item.Values
If h <> "" Then
'Check Division Name+++++++++++++++++++++++++++++++++++++++++++++++
'-- Add value to list item.
If sitedoc.sitname(0) = "Bilston Hostel" Then
If groupList("Bilston Hostel All Staff") = "" Then
groupList("Bilston Hostel All Staff") = h
Else
groupList("Bilston Hostel All Staff") = groupList("Bilston Hostel All Staff") & "~" & h
End If
'Check Division Name+++++++++++++++++++++++++++++++++++++++++++++++
'-- Add value to list item.
Elseif sitedoc.sitname(0) = "Birmingham Prison" Then
If groupList("Birmingham Prison All Staff") = "" Then
groupList("Birmingham Prison All Staff") = h
Else
groupList("Birmingham Prison All Staff") = groupList("Birmingham Prison All Staff") & "~" & h
End If
'Check Division Name+++++++++++++++++++++++++++++++++++++++++++++++
'-- Add value to list item.
Elseif sitedoc.sitname(0) = "Bishop Street" Then
If groupList("Bishop Street All Staff") = "" Then
groupList("Bishop Street All Staff") = h
Else
groupList("Bishop Street All Staff") = groupList("Bishop Street All Staff") & "~" & h
End If
End If
End If
End Forall
End If
Set sitedoc = v.getnextdocument(sitedoc)
count = count + 1
Loop
End Sub

Item not being set (Nadeem Shaikh 10.Mar.04)
. . 