I’m opening a modal form to load a document from an embedded view.
When the user clicks on the OK button it saves the changes to the doc (inside the modal screen) and then return to the documnet with the embedded view. So far no probs…
but if i want the code inside the button that saves the modal doc to ALSO change the values of a few fields in the document with the embedded view I keep getting ‘object variable not set’ every time i try referencing doc.field1. I tried re’setting the doc, uidoc. ws, db, everything! but i keep getting the same error.
Is there a work around? Is there a way of getting a ‘hold’ of the document with the embedded view that was the parent (source) of the document that is currently opened in the modal screen?
Let me know if I’m not explaining this properly.
Below is the code inside the button of the modal form:
Dim db As NotesDatabase
Dim session As New NotesSession
Dim doc As notesdocument
Dim uidoc As notesuidocument
Dim ws As NotesUIWorkspace
Set db = session.currentdatabase
Set ws = New NotesUIWorkspace
Set uidoc = ws.Currentdocument
Set doc = uidoc.document
doc.SaveOptions = "1"
Call uidoc.Save
'this saves the document in side the modal form
call uidoc.close
'closes the modal form
Set db = session.currentdatabase
Set ws = New NotesUIWorkspace
Set uidoc = ws.Currentdocument
Set doc = uidoc.document
'whethere i re-set these things or not i still get an 'object variable not set' on the next line
doc.Field1 = "12345" 'this is where i get 'object variable not set'
Thanks
ST