User defined error

i am facing a problem,when i am opening a document using a the UNID.

in my part of code as in below…

i am also editing document, and i have also default view.

The field Req_link is holding the value of the UNID,

by fetching this unid earlier i was able to open the document,but now its showing “user defined error”,and in another form the same code showing the error message----“Do you want to save the document” so what to do in this condition?

my code—>

Dim uiws As New NotesUIWorkspace

Dim session As New NotesSession

Dim database As NotesDatabase

Dim doc As NotesDocument

Dim uidoc As NotesUIDocument

Set database = session.CurrentDatabase

Set uidoc = uiws.CurrentDocument

'Call uidoc.Refresh

Set doc = database.GetDocumentByUNID(uidoc.FieldGetText(“Req_Link”))

Set uidoc=uiws.EditDocument(False,doc)

Any help will be Appreciable !!

thanks in Advance

Rupesh

Subject: user defined error…

I think the problem is occurring because you are re-assigning ‘uidoc’ to another document.

If you want to open the linked document in a new window you change the following line:

Set uidoc=uiws.EditDocument(False,doc)

to:

Call uiws.EditDocument(False,doc)

If you want to close the existing document then you can call ‘uidoc.Close’ prior to opening the new document.

Alex

Subject: RE: user defined error…

Hi Alex,

i have tried your code,but it still giving “user defined error” at that particular point…Actually earlier it was working …

now i am making the project into web based,and i set the form properties to “Automatically enable edit mode”,

i was thinking for this property the erro is occuring… but even after removing this property still error continuing…so what can be the reason…Any other idea.