Opening a Document Link

I created an lookup that loads the doc link of a document from another database. I tihen created a button to open that document link. Currently when I try to run it I get a “Incorrect Argument Type: Object Expected.” It has the error on the last line. I would like to open the document in read mode Any help would be great.

Sub Click(Source As Button)

Dim session As New NotesSession

Dim ws As New NotesUIWorkspace

Dim dbJN As NotesDatabase

Dim dbGEN As NotesDatabase

Dim viewGEN As NotesView

Dim docGEN As NotesDocument

Dim uidocGEN As NotesUIDocument

Dim uidocJN As NotesUIDocument

’ Set Variables

Set dbJN = session.CurrentDatabase

Set dbGEN = New NotesDatabase ( dbJN.Server , "mail\\ntemp.nsf" )



Set viewGEN = dbGEN.GetView ( "by Subjects" )



Set uidocJN = ws.CurrentDocument

Set docGEN = viewGEN.GetDocumentByKey ( uidocJN.FieldGetText ( "POLink" ) )



'Set uidocGEN =  ws.EditDocument ( False, docGEN )

Call ws.EditDocument(False, docGEN)

End Sub

Subject: Did you check docGEN?

  • If the line that sets that doesn’t find anything, it will be Nothing or Empty, depending on how LotusScript feels that day. Even if you know POLink has a value it’s wise to check document fetches to be sure something actually came back.

If(docGen is Nothing or isEmpty(docGEN)) then

’ complain, maybe dump POLink for verification

else

’ use docGen

end if

  • Hope this helps…