DaveInIowa
Programmer
Is there any way to return from a modal form without using Me.Hide? I would like to show a modal form and wait for input. Afterwards, I extract values from the form via user-defined properties (one of which tells me whether the OK or Cancel button was clicked). I then use these properties as parameter values to a longer running subroutine. What I'd like to do is to keep the form visible with the OK button disabled and the Cancel button still active for the user to set a global boolean to stop the longer running sub.
I've tried displaying the form (modally), then using a user-defined property (.Mode in the code below) to disable the OK button, then displaying the form again as modeless. This works but will not redisplay the form in its same location if it has been moved. I don't want to go to the trouble of saving its coordinates to manually set its position for the redisplay.
I realize I could call my subroutine from within the form itself, but this type of coupling is what I'm trying to avoid. I don't want to tie a form to a specific procedure.
I've tried displaying the form (modally), then using a user-defined property (.Mode in the code below) to disable the OK button, then displaying the form again as modeless. This works but will not redisplay the form in its same location if it has been moved. I don't want to go to the trouble of saving its coordinates to manually set its position for the redisplay.
I realize I could call my subroutine from within the form itself, but this type of coupling is what I'm trying to avoid. I don't want to tie a form to a specific procedure.
Code:
Public Sub PromptRefresh()
frmPrompt.Mode = Prompting
frmPrompt.Show
If (frmPrompt.DialogResult = vbOK) Then
frmPrompt.Mode = Executing
frmPrompt.Show vbModeless
DoEvents
Call ExecuteRefresh(frmPrompt.WhereClause)
End If
Unload frmPrompt
End Sub