Help with some code

I’m running into an error and could use some help. Lines 38 & 40 generate the same error message, which only appears in the debugger. Other side effect is that save conflicts are being created if further edits are made to the document.

here’s the code…

Sub GetDocumentLinks (db As NotesDatabase, uidoc As NotesUIDocument)

Dim db2 As NotesDatabase

Dim view As notesview

Dim view2 As notesview

Dim relview As notesview

Dim cdoc As NotesDocument

Dim doc As notesdocument

Dim item As NotesItem

Dim rtitem As NotesRichTextItem



Dim contnum As String

Dim curcat As Variant

Dim server As Variant

Dim path As Variant

Dim key As String

Dim ad As String

Dim formname As String

Dim searchitem As String



On Error Goto ErrorRoutine

Print "Getting the Document Links"

Dim session As New NotesSession

Dim w As New NotesUIWorkspace



Set db = Session.CurrentDatabase

server = db.server

Set cdoc = uidoc.document

cdoc.saveoptions = "0"

Call uidoc.close

'.

'.do work on the backend document (cdoc)

'.

Call cdoc.save(True,False, True)

Call view.Refresh

' ***** Error start on next line & error message only occurs if debugger is running.

' ***** Error Message:  unexpected condition 4412:NotesError - Specified command is not avaliable from the workspace.

Call w.ViewRefresh

'***** If we commented out the above line, then the next line generates same error

Set uidoc = w.EditDocument ( True,  cdoc, False)

Call uidoc.gotofield("rtfassociated") 'this is the doc link field

Set cdoc = uidoc.document

 'cdoc.saveoptions = 1

Call cdoc.removeitem("SaveOptions")

cdoc.removeitem("stopdoclock")

Call cdoc.Save(True, False, True)

Exit Sub

ErrorRoutine:

Messagebox "Unexpected Condition " & Err () & ": " & Error()

Err = 0

Exit Sub

End Sub

Subject: Help with some code

Do you only get the save conflicts when you are debugging? If you are not in debug mode, are there any problems? I’ve found that sometimes debug mode causes problems that do not exist when using the application as a normal user.-Heather

Subject: RE: Help with some code

Heather,

The error message is only displayed if the debugger is running.

I do get the save-conflict errors either way.

Thanks

Mark

Subject: Help with some code

Any chance you’re in a clustered environment? If so, the doc saves in rapid succession may be generating the rep/save docs - update doc, save doc, doc replicates to cluster right as the 2nd save happens and you have a conflict doc.

No clue about the rest.

HTH

Doug

Subject: RE: Help with some code

sorry, not in a cluster.

Subject: Help with some code

What is it you are trying to accomplish?

Subject: RE: Help with some code

I’m integrating code from SWING into another application ( QSI System 9000). The code here is from QSI.QSI’s code gives an error, but since the end user never sees anything, it appears to work correctly. So QSI most likely does not know that there is an issue.

When I added the Swing components, the errors generated are compounded and are causing save-conflicts to be created.

My question is… the code looks to be correct

The uidoc is closed, changes are made to the doc & then refreshed. then the uidoc is reopened in edit mode, the cursor put back to where the user left off & some fields are updated.