Does anyone know why the coll.count is not returning and creating the new doc? I ran the debugger and there is where it shows no docs are there although there are docs.
Sub Click(Source As Button)
Dim session As New NotesSession
Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim db As NotesDatabase
Dim doc As NotesDocument, doc2 As NotesDocument
Dim a(300) As String,b(300) As String,c(300) As String,d(300) As String, e(300) As String, f(300) As String
Dim picklist As Variant
Dim key As String
Dim location As String
Dim coll As NotesDocumentCollection
Set db = session.CurrentDatabase
Set view = db.Getview("Report by Year")
'give them the view to choose a document from
server = db.server
dbname = db.FileName
viewname = "showlocation"
'give them a list of documents for selection
picklist = ws.Pickliststrings(3,1,server,dbname,viewname, "Form","Select a Location.",3,"")
If Isempty(picklist) Then Exit Sub 'they have pressed cancel
location = picklist(0)
key = picklist(0)
Set coll = view.GetAllDocumentsByKey(key, True)
If coll.Count > 0 Then
Set doc2 = db.CreateDocument
doc2.form = "300Form"
Set doc = collection.GetFirstDocument
Do Until doc Is Nothing
doc2.a = CaseLog
doc2.b = EmpFullName
doc2.c = EmpJobTitle
doc2.d = CaseDate
doc2.e = CaseWhereOccurred
doc2.f = CaseInjuryorIllnes
Set doc = collection.GetNextDocument(doc)
Loop
'Call doc2.save( True, True )
Set uidoc = ws.EditDocument(False, doc2)
End If
End Sub