From within a view I am triggering a dialogbox in LotusScript to pull data from three fields (three address lines) on the selected doc in the view into one on the dialogbox. I have all matching fields from the form on the dialogbox and then one field with the radio buttons that pulls the fields into one. (I tried putting all three fields in the formula lookup for the radio buttons too, but it didn’t work either.)
Nothing at all is displaying in my dialogbox. It is like it isn’t making a connection to the selected doc in the view. I had gotten a handle on the doc in the view with set doc = s.documentcontext but didn’t see where that would make a connection with the dialogbox.
Here’s the code - tips?
Dim w As New NotesUIWorkspace
Dim s As New NotesSession
Dim db As NotesDatabase
Dim DialogBoxDoc As NotesDocument
Set db = s.CurrentDatabase
Set DialogBoxDoc = New NotesDocument(db)
If w.dialogbox("DBAddressSelection", True, True, False, False, False, False, "Select Address for Map", DialogBoxDoc) Then
Msgbox "Success"
End If
Subject: DialogBox from a view
Dave, Andre, and Stan:
Thank you so much for your input. I changed DialogBoxDoc to documentcontext and it worked! Every example I was seeing was making the notesdocument a new document which didn’t make sense to me. This makes sense now!
Thanks again!
Lady Sterling
Subject: DialogBox from a view
You need to copy the data from the selected doc in the view to DialogBoxDoc. The form that runs as a result of the dialog box call is in a different exection context.
Subject: RE: DialogBox from a view
But shouldn’t dialogbox inherit the fields from the selected document in the view?
Subject: RE: DialogBox from a view
When you supply a NotesDocument, it displays the fields in that document instead of the ones in the current selected document. Since you just created the document, all its fields are blank.
Anytime you work with a NotesDocument, you do all your own field assignments.
You could not supply a document, but then you would be editing the document that’s in the view. Copying the fields is probably better.
CopyAllItems is available if you want to initialize the dialog doc with everything in the selected document.
Subject: RE: DialogBox from a view
In formula language, yes. In LotusScript, it uses whichever document you supply in the document parameter (in this case DialogDoc, a new, empty document). If you set doc to the DocumentContext, then feed doc to the DialogBox method rather than creating a new document.