Object variable not set error?

Hi All,I am getting the error object variable not set while executing the line.

If WorkSpace.DialogBox(“.ObjRSNCDlgRuleSearch”,True,True,False,False,False,False,“Rule-based Search”,Doc, True, False) Then

Any clue??

Subject: object variable not set error??

Yes

Workspace has probably not been set

Subject: RE: object variable not set error??

Doc set as Set Doc=Session.CurrentDatabase.CreateDocument

Subject: RE: object variable not set error??

I see in debugger that Woekspace is set and doc is also set.Any other reason?

Subject: RE: object variable not set error??

So both WorkSpace and Doc have values? Not just in the list of variables - you can expand them and see the data? Also make sure spellings match, it’s WorkSpace and not ws or something else (have to ask as we’ve all had the classic typo and not seen it)

If WorkSpace.DialogBox(“.ObjRSNCDlgRuleSearch”,True,True,False,False,False,False,“Rule-based Search”,Doc, True, False) Then

Is it possible the problem is then occuring on the actual Form .ObjRSNDlgRuleSearch and not here in the code?

Have you tried changing the form to something else - just a simple form with a single field on it and see if it comes up OK then? If it does, then you know it’s something about the form.

Subject: RE: object variable not set error??

Right problem was with PostRecalc event of form.Now working fine.Thanks

Subject: object variable not set error??

Either Doc is Not set of WorkSpace is not set. A bit more code would help. What do you see in the debugger, is either not set?

For example, how are you setting doc? I recently discovered the following doesn’t always work

Set doc = ws.currentdocument.document

Notes Help says to use getcurrentdocument instead so I changed it to

Set doc = ws.getcurrentdocument.document

Fixed the problem for me.