Count the number of documents in a view

Counts documents in the view "viewname" in the sample.nsf database.
Lotus Notes View • LotusScript


Dim session as new NotesSession
Dim db As NotesDatabase
Set db = session.currentdatabase
Dim view As NotesView
Set view = db.GetView("viewname")
Dim collect as notesdocumentcollection
set collect = view.Allentries
Messagebox(collect.count)

OR

Dim session as new NotesSession
Dim db As NotesDatabase
Set db = session.currentdatabase
Dim view As NotesView
Set view = db.GetView("viewname")
Dim doc As NotesDocument
Dim count As Integer
Set doc = view.GetFirstDocument
count = 0
Do
   count = count + 1
   Set doc = view.GetNextDocument(doc)
Loop until doc is nothing
Messagebox(count)

Posted by fbrefere001 on Friday February 23, 2001