Run Exiting/On Change Events After Value Change

I have the following code in a combobox field in the OnChange event (values are Yes, No) called ArkemaPrepContract.

The code works fine. However, I want the form Supply Contract to compose immediately when the user selects Yes. Currently the form will compose 2 times when the Run Exiting/On Change Events After Value Change option is selected. When the user selects Yes and also when the user exits the ArkemaPrepContract field.

If I deselect Run Exiting/On Change Events After Value Change, then the Supply Contract form displays only when the user exits the field ArkemaPrepContract.

Any suggestions?

Dim ws As New notesuiworkspace

Dim uidoc As notesuidocument

Dim uidocNew As NotesUIDocument

Dim doc As NotesDocument

Set uidoc = ws.CurrentDocument

Set doc = uidoc.Document

If doc.ArkemaPrepContract(0) = “Yes” Then

Call ws.composedocument(“”,“”,“Supply Contract”)

Else

doc.ArkemaPrepContract=“No”

Call uidoc.Refresh '(optional)

Call uidoc.Save '(optional) or you could call doc.Save(False, True)

End If

Subject: Run Exiting/On Change Events After Value Change

Create a global variable and set it equal to 0. If it runs when the value changes, set the global variable to 1. Add a check to the code that only runs the code if the global is equal to 0.

hth.

brandt