I have View-A that displays “Form-A” populated from our AS400 during the night. When a user wants to edit the form in View-A, a Form Formula switches it to “Form-B”. I like this because its seamless to the user. They don’t “have to” click on a view Action Button to switch the form. They can double-click, use a Action Button or even CTRL+E or CTRL+O, the form always gets switched to Form-B.
However, the problem is I cant figure out how to leave Form-A and create a Form-B by using the Form Formula? With the above example the form actually switches from Form-A to Form-B, meaning its removed from View-A! Sure, I can create a action button, but then they have to use the action button or it wont work. With hundreds of users, many use quick keys, etc.
My goal here is to use a second form to do the editing so it can be stored in a different view for review, and leave the original Form-A documents untouched for others to use. How can I do this using a Form Formula or something similarly universal and almost fool proof?
Subject: One way
If you don’t use the versioning method, below is a beginning of another approach.
Sub Querysave(Source As Notesuidocument, Continue As Variant)
Dim session As New NotesSession
Dim db As NotesDatabase
Dim docA As NotesDocument
Dim docB As NotesDocument
Set db = session.CurrentDatabase
Set docA = Source.Document
Set docB = New NotesDocument( db )
Call docA.CopyAllItems( docB, True )
Call docB.ReplaceItemValue("Form","Form-B")
Call docB.Save( True, True )
'prevent docA document from saving
Continue = false
'can put code here to close docA and open docB in the user interface
end sub
Subject: Re: One way
Thanks Rob!!! Thats working out great. However, I dont think this part of your code is possible: “Can put code here to close docA and open docB in the user interface”. You have this code in the QuerySave event, isnt it a conflict to try and close docA in its “QuerySave” state?
Ive got it working with a “Save and Close” button on the form using the formula below, but I havent yet taken into account if the user clicks the “X”, or uses the “CTRL+S”, “CTRL+W” & “Esc” keys. But Im much closer than I was, so thanks a ton!
My “Save and Close” button on the form:
@Command([FileSave]); <–triggers the QuerySave events.
FIELD SaveOptions := “0”; <–allows form to close w/out a prompt.
@Command([FileCloseWindow]) <–closes form and takes you back to view.
Subject: Left wanting my Form Formula to do more?
There are “versioning” options in the Form Properties dialog. I think you’ll want to set them on Form B, since that’s the one that you are doing the actual editing with. “New versions become siblings” is probably the option that you want. You’ll end up with the original doc still stored with Form A and still therefore visible in View A, but the edited doc stored as a new doc with Form B and therefore visible in View B for review.
Subject: RE: Left wanting my Form Formula to do more?
I really wanted to use this method, but I couldnt get it to work as I need it to. Yes, turning on “New versions become siblings” did create a new verison and leave the original intact, but when you edit the new version a second time, it creates another version of it, etc, etc.