REMINDER: On December 1, 2018, this forum will be closed to new posts and responses. After that date, you will still be able to view and search the forum. New discussions should take place in the IBM Developer Answers forum.
You are getting View Entries NOT Documents Alan J White 22.Jul.08 01:34 AM a Web browser Applications Development 6.5.6All Platforms
Some background first:
a Notesview IS a list built using documents
simple views appear as one row for each document
so there are methods on a view to getfirst document, Getnext etc
This is what is happening in the version of your code that does not error
However a view CAN be more complex
it can be categorised (to many levels)
and have totals or conflicts showing etc.
On screen that results in 'rows' in the list that have no corresponding documents
To cope with this the concept of a ViewEntry is intoduces
There are equivalent methods on a view GetFirstEntry etc
A viewentry object then has properties to tell you what it represents e.g. IsCategory
If a ViewEntry IsDocument a further property allows you to access the corresponding document
Hope that is clear :-)
The key to your problems is that the method you are using to get your collection is v.allENTRIES (my capitalisation)
As the name suggests it returns a collection of ViewEntries NOT (directly) documents.
Since dc is defined as an Object (equivalent to a Variant in Lotusscript) assigning a VE Coll to it not a doc coll produces no error.
Unfortunately once you try to use Doc Coll METHODS they fail.
Your mistake is understandable:
the method allEntries DOES eliminate from the resulting collection any entry where IsDocument is false
however the returned entries are still View Entries not documents
and the collection itself is a VE collection.
There are many ways to avoid this problem e.g based on
Dim session As Object
Dim db, doc As Object
Dim v, ec, e As Object
session = CreateObject("Notes.NotesSession")
db = session.GetDatabase("*****", "*****")
v = db.GetView("*****")
ec = v.AllEntries
e = ec.GetFirstDocument
doc = e.GetDocument