I have a main form (IR) that has a button that I want to create 2 other forms (Size and Read). (not sure if this is the right approach)... i want users (could be multiple) to open the Entry form and key in data which updates the Size form.
there are many fields on both the entry and read (same form duplicate copies) so the users would enter data on certain fields (not the same). the code i have gives me strange results (docs w/o fields, multiple etc).
here is some of the code where i think the problem is.
Dim workspace As New notesuiworkspace
Dim session As New NotesSession
Dim uidoc As NotesUIDocument
Dim entrydoc As NotesDocument
Dim sizedoc As NotesDocument
Dim view As NotesView
Dim db As NotesDatabase
Set db = session.CurrentDatabase
Set uidoc = workspace.CurrentDocument
Set entrydoc = uidoc.Document
Set view = db.GetView("SizingDocs")
' Find the cooresponding sizing doc
Set sizedoc = view.GetDocumentByKey(entrydoc.SizeDocNo(0))
If sizedoc Is Nothing Then
Set sizedoc = New Notesdocument(db)
sizedoc.form = "Sizing"
sizedoc.docno = entrydoc.docno(0)
Call sizedoc.Save(True, False)
End If
Print "Updating sizing document. . ."
Call entrydoc.CopyAllItems(sizedoc, True)
sizedoc.form = "Sizing"
sizedoc.SizeDocNo = entrydoc.SizeDocNo(0)
Call sizedoc.Save(True, True)
Print ""
'entrydoc.SaveOptions = "1"
Call entrydoc.Save(True, False)
entrydoc.SaveOptions = "0"
entrydoc.UsedButton = "Yes"
uidoc.close
sizing form - update sizing
Dim sizingdoc As NotesDocument
Dim ws As New NotesUIWorkspace
Dim entrydoc As NotesDocument
Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim uidoc As NotesUIDocument
Set uidoc = ws.CurrentDocument
Set db = session.CurrentDatabase
Set sizingdoc = uidoc.Document
Set view = db.GetView("SizingEntryDocs")
Set entrydoc = view.GetDocumentByKey(sizingdoc.SizeDocNo(0))
If entrydoc Is Nothing Then 'doesnt exist
Messagebox "Sizing Entry doc is missing, contact support"
Else
Set uidoc = ws.EditDocument(True , entrydoc)
'Call uidoc.Reload
Call uidoc.Close
End If
Software/Hardware used:
ASKED:
June 23, 2006 9:17 AM
UPDATED:
June 27, 2006 7:25 AM
I ended up redoing the code using uiworkspace.DialogBox and it worked just the way I wanted. I also realized that I didnt need to update the entry form (It was a way to load the read form)
Thanks for your help
Mark