I'm trying to create a progress bar with a programmed table in the "Switcher mail form." In the code, when I want to set a hide field to calculate the value of the table in sub queryopen, the program shows the message "variable object not set."

Sub Queryopen(Source As Notesuidocument, 
Mode As Integer, Isnewdoc As Variant, 
Continue As Variant)
Dim doc As notesDocument
Set doc = source.document
doc.calculo = "1" 
End Sub

I know that I should use "If NOT Isnewdoc," but I have to set the field "calculo" anyway. Do you have an example to set a field in queryopen?

The QueryOpen event happens before the Lotus Notes document is opened. In QueryOpen, the source.document is not yet set. You should use the PostOpen or OnLoad events to set a field value. These occur after the document loads but before the user has access to the fields.


Do you have comments on this Ask the Expert Q&A? Let us know.

This was first published in June 2006