Problem with uidoc in QueryOpen

Hi,I have a problem where I’m trying to set a value of 0 in a numerical field using the QueryOpen option. My problem is that I get an “Object Variable not Set” error message when you try and open a document. Any Ideas? Please see my code below:

Sub Queryopen(Source As Notesuidocument, Mode As Integer, Isnewdoc As Variant, Continue As Variant)

Dim db As NotesDatabase

Dim uidoc As NotesUIDocument

Dim workspace As NotesUIWorkspace

Dim item As NotesItem	

Dim session As NotesSession



Set uidoc = Workspace.CurrentDocument

est = uidoc.FieldGetText("estSRhrs")

If est = "" Then

	Call uidoc.FieldSetText(estSRhrs,0)

Else

End If

End Sub

Subject: Problem with uidoc in QueryOpen

Why are you using the NotesUIWorkspace to get the current document ??

You get it using the variable Source from the parameters…

A clean code would be :

est = Source.FieldGetText(“estSRhrs”)

If est = “” Then

Call Source.FieldSetText(estSRhrs,0)

Else

… the other code…

End If

I saw sometimes problems with the kind of code your made, where notes doesn’t return any value for Workspace.CurrentDocument (especially when using frameset).

Using the Source variable, your sure to have the right document !

Hope this helps !

Renaud

Subject: Problem with uidoc in QueryOpen

U have missed the line

set workspace = New NotesUIWorkspace

Subject: Problem with uidoc in QueryOpen

Use the PostOpen event as the fields are not available yet in QueryOpen.

Don