Beginner LS Problem

I am trying to get a simple count of documents that are open. It keeps returning 0, which is not the case.


Dim db As New NotesDatabase( “”, “vhd.nsf” )

Dim collection As NotesDocumentCollection

Dim vw As NotesView

Set vw = db.GetView(“SCMonthlyReport”)

If vw Is Nothing Then

MessageBox "No View"

Exit Sub

End If

Set collection = vw.Getalldocumentsbykey(“Open”, false)

MessageBox collection.Count

Subject: Some questions

Some questions :

  1. Is vhd.nsf the database you develop in ?

If yes, modify your code by replacing :

Dim db As New NotesDatabase( “”, “vhd.nsf” )

with :

dim session as new notessession

dim db as NotesDatabase

set db=session.CurrentDatabase

  1. Control the your view SCMonthlyReport has the data you search for in the first column AND that this first column is sorted. It doesn’t matter if it’s ascending or descending but it has to be sorted.

Hope this helps

Renaud

Subject: Re: beginner LS Problem

Your problem might be the fact that you’re trying to feed your messagebox with an integer.Try msgbox Cstr(collection.count)