Creating 2 docs from main

Lotus Domino
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

Answer Wiki

Thanks. We'll let you know when a new response is added.

If I understand your goal correctly you are updating doc 1 with an “id” from doc 2 and vice versa so that from either doc you can directly access the other?
If so, it looks like a simple bug in your code where you don’t update entrydoc with the id from sizedoc. You appear to update 2 fields in sizedoc from fields in entrydoc:

sizedoc.docno = entrydoc.docno(0) (when sizedoc not found)

sizedoc.SizeDocNo = entrydoc.SizeDocNo(0) (after copying all entrydoc items into sizedoc)

but nowhere do you update entrydoc with a reference back to sizedoc so I am guessing that the last section of code generally doesn’t work?

Please clarify which field on each form is the key field used in each of the views “SizingDocs” and “SizingEntryDocs”. It’s a bit hard to follow otherwise.

Discuss This Question: 1  Reply

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • Skister77
    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
    0 pointsBadges:

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.


Share this item with your network: