QueryOpen to update form fields

I need to write a QueryOpen event that looks to the “Control” view and matches the form name then updates two fields called Source and ViewSource from the form saved in the view. This is all I have so far. Any help?

Dim session As New NotesSession

Dim db As NotesDatabase

Dim view As NotesView

Dim doc As NotesDocument



Set db = session.CurrentDatabase

Set view = db.Views( "Control" )

Set doc = view.GetAllDocumentsbyKey

Subject: QueryOpen to update form fields

Couple of hints:GetAllDocumentsByKey needs a key

GetAllDocumentsByKey returns a doc collection not a doc.

If you have one and only one doc in the Control view, set the doc by getDocumentByKey (no ‘S’ and include your key).

Move along doing exactly what you propose.

Use ‘help’ - there are almost complete examples that show you how to do all the bits you need - spend a bit of time playing and you should be able to get to the code you need without much more work.

Doug

Subject: RE: QueryOpen to update form fields

Thank you, Doug. I will use the GetDocumentbyKey method and figure out where to go from there. Thanks for pointing me in the right direction!