I’ve made some changes to the “System:Close Opportunity” view and I want to add some form validation before closing the form. I’ve hidden the OK button and added a new “Save” button that triggers my form validation.
The form is opened from “System:Opportunity Detail” with this code:
Set objMainView = Application.MainViews.Add(“System:Close Opportunity”, 0, False) ‘DNL
If objMainView.ShowModal = mrOK Then
I tried to close the customized form with both if these options:
Application.BasicFunctions.CloseCurrentView(FALSE) <-- Doesn't do anything to the form altarnative: frmCloseOpportunity.ModalResult = mrOK Application.MainViews.ActiveView.Close <-- Closes the form, the Opp Detail view, and causes an exception Can someone tell me the proper way to close the form and have the result come back as "mrOK"? Answer: Leave the OK button in place - notice each form has a OnCloseQuery event - put your validation in here and then return "false" to prevent it closing - otherwise, it stays open until your validation occurs.