Composing document -please help!

I have followin code which composes a document form another document

Dim ws As New NotesUIworkspace

Dim session As New notessession

Dim db As NotesDatabase

Set db=session.CurrentDatabase

server=db.Server

Dim doc As notesdocument

Dim doc1 As NotesDocument

Dim uidoc As NotesUIDocument

Dim uidoc1 As NotesUIDocument

Set uidoc=ws.CurrentDocument

Set doc=uidoc.Document

Set uidoc1=ws.ComposeDocument(server,"db","form")

Set doc1=uidoc1.Document ---{doc1 is not set here}

doc1.odocid="test" --- {Therefore gives err here object variable not set}

the err is shown under 2 conditions

  1. if the doc is not saved then it works fine only is save ans execute the above cod gives err.

  2. if “formulas inherit values” from target form is unchecked then also it works fine (saved or unsaved doc)

but i want the above code to work when current doc is saved aslo and the target form has “formulas inherit values” property.

why does it give an error when current doc is saved??

please help!!

Subject: composing document -please help!!

You need to set uidoc1 document object just as you did for uidoc.Set uidoc1=ws.CuurentDocument.

I think you might have mised this line of code and hence getting the error.

I hope this will help you!

Regards,

Kaushal Naik.

Subject: composing document -please help!!

Not sure why you are seeing this problem, but I would look at the form used by your new document and check it is working correctly.

Is uidoc1 being set when you are getting an error? Does it open in the workspace? If not, then I suspect there is some problem with your inherited values.

Can you use a simple @Command( [Compose] ) for testing purposes? Does the same situation occur (error if the current document is saved, no error if it is not)?

Subject: RE: composing document -please help!!

Yes my uidoc1 is getting set properly only when i assign it to a document it is not set (uidoc1 ) opens in the workspace

Subject: composing document -please help!!

Hi,

i not reali sure if this works but have u set the name of the server correctly?

If u using locally, maybe u can leave the first 2 field empty.

Hope this helps.

Best

Hengshi