Variant does not contain an object Error because of a dialogbox

Hi !

I have the following error message went i try to open a dialogbox : Variant does not contain an object.

before all my code was in the action, and it told me that the dialogbox cannot be used in this context, so i putted the following part of code in the “initialize” part :

Sub Initialize

Dim s As New notesSession

Dim w As New notesUiWorkspace

Dim db As notesDatabase

Dim tmpDoc As notesDocument

Set db=s.currentDatabase

Set w=New notesUiworkspace

Set tmpDoc=db.createDocument

End Sub

And the in the action, i just left the folowing line :

dlgFlag = w.DialogBox( “Demande”,True,True,False,False,False,False, “S.V.P.”,tmpDoc,True,False)

So, anyone has an idea of what is the problem ? Maybe that i should put all the code together, but then it told me that the dialogbox cannot be used in that context… I’m a little confuse now :stuck_out_tongue:

Subject: Variant does not contain an object Error because of a dialogbox

I assume you put the code in the initialize of the action?Since all the objects you create are not global the acutal action (click) does not know about what you did in the initialize.

So you do need to put all the code together and deal with the error.

read through the helpfile and find out why you are not allowed to use the dialogbox :slight_smile:

Subject: RE: Variant does not contain an object Error because of a dialogbox

Marjan is quite correct about your scope issues. Please read this article and part 2 to learn about the error you’re getting now. If you go to Google and search for the error you were getting before, you will find a probable explanation right near the top of the search results. The message doesn’t always mean you can’t use Dialogbox in that context – sometimes it just means you’re using it wrong.