LotusScript bug in 6.0.1?

I’ve found what appears to be a bug with LotusScript in Notes 6.0.1.

In the code below (used in a script library), the setConfigDoc function works perfectly in 6.0 and 5.0.x, but in 6.0.1 it fails with “Object variable not set”.

This behaviour has been seen on several computers in our organisation, though the only operating systems it’s been tested on are Windows 2000 and Windows 98 SE.

It seems as if the Initialize sub is either not running, or otherwise fails to set the db object.

Can anyone else confirm this as a bug?

If so: Lotus, please fix this.

(Declarations)

Dim s As NotesSession

Dim db As NotesDatabase

Dim configDoc as NotesDocument

Sub Initialize

'Initialise s and db

Set s=New NotesSession

Set db=s.CurrentDatabase

End Sub

Function setConfigDoc As Variant

’ Set configDoc to the database configuration document

’ Return true if successful, false otherwise.

Dim view As NotesView



If configDoc Is Nothing Then

	setConfigDoc=False

	

	'*** The following line produces "Object variable not set" in Notes 6.0.1

	Set view=db.GetView("v-config")

	

	If view Is Nothing Then Exit Function

	

	Set configDoc=view.GetFirstDocument

	If configDoc Is Nothing Then Exit Function

End If



setConfigDoc=True

End Function

Subject: LotusScript bug in 6.0.1 ?

I’ve tested this and it runs perfectly - no errors produced.I assume that You have previously somewhere in Your code also declared the variable configDoc as NotesDocument…

Subject: RE: LotusScript bug in 6.0.1 ?

I accidentally left that out of the code I posted, though it’s in the actual script library. I’ve updated the initial post with this.

The problem has gotten weirder - I’ve got 2 forms on which this problem occurs, in separate databases using basically identical script librares. Other forms in the same databases, and using the same script library, do not have the problem. Also, I’ve tried copying bits of code to a test database, and have been unable to replicate the problem - I expect there’s some combination of factors that make this happen, but I haven’t found it yet.

Subject: Argh! Globals! Hate them! (WAS: LotusScript bug in 6.0.1 ?)

That initialize code should work just fine, and indeed did on my machine. You may have an object / variable name collision going on elsewhere… Exactly why I avoid global objects and variables like the plague!