Object Variable Not Set

I have a problem and I can’t figure this out. A specific user is experiencing an object variable not set error when saving a document. In the PostSave event, I have the following code snippet:

Sub Postsave(Source As Notesuidocument)

Dim ns As New NotesSession

Dim db As NotesDatabase

Dim nc As NotesDocumentCollection

Dim responsedoc As NotesDocument

Dim item As NotesItem



Set db = ns.CurrentDatabase

Set nc = Source.Document.Responses



If (nc.count <> 0) Then

The error happens on the last line. The ns (session), db (database), and Source (uidoc) are set, but for some reason, it can’t get a collection (nc). Given the fact that the other variables are set, why would it fail to set nc?

It only happens to a specific user. I deleted their cache.ndk, bookmark.nsf, and removed/re-added the database bookmark, but none of these helped.

Subject: Object Variable Not Set

I assume the document does have some responses?

Does it have a reader’s field that would make it invisible to that user?

The security tab in the response document maybe is not at “Reader’s and above”

Subject: RE: Object Variable Not Set

The document doesn’t always have responses, but if it doesn’t, it still returns a collection of 0 documents (hence the check to ensure the collection <> 0).

However, the problem was with a reader’s field. Thanks!

Subject: Object Variable Not Set

From the help on responses:

Note This property is not available for a new document, and will return Nothing. The document must be closed and reopened before the property is available.

Is this the cause? You need to check whether this is a newly saved doc otherwise it won’t work