I closed a modal window by hiding it (common.visible=false) and the hidden form continued to be modal so I had to have Windows shut down MM
What's the correct way of unloading a modal form?
How to close a modal form?
If you set the button's ModalResult to a value you don't have to provide a click handler and the modal form closes:
Code: Select all
Set OKBtn = SDB.UI.NewButton(Form)
OKBtn.Caption = "&OK"
OKBtn.ModalResult = 1
Set CancelBtn = SDB.UI.NewButton(Form)
CancelBtn.Caption = "&Cancel"
CancelBtn.ModalResult = 2
res = Form.ShowModal
If res = 1 Then
MsgBox "OK Pressed"
Else
MsgBox "Cancel Pressed"
End If