Hi,
Global variable or Properties can be used as your suggestion.
Assume you have Ok and Cancel button in your modal form.
In the Modal form, user can click Ok button for approval and for disapproval they can click Cancel Button or Close Button.
When Close button is Clicked the form Unloads from Memory. so u can only receive the default values. At this
When Cancel button is clicked you should hide the form instead unload from memory and Make the Variable False(default value).
When Ok button is clicked here also you should hide the form instead unload from memory and Make the Variable True.
Finally you can unload the form after shown modally.
Ex
Assume this is login form(frmLogin) Cotains Ok and Cancel button
Public LoginSucceeded As Boolean
Private Sub cmdCancel_Click()
'set the global var to false to denote a failed
LoginSucceeded = False
Me.Hide
End Sub
Private Sub cmdOK_Click()
'check for Login
If DoLogin() Then
LoginSucceeded = True
Me.Hide
Else
'Invalid User Name or Password
End If
End Sub Then you use this login form may be like
Private Sub cmdLogin_Click()
Dim fLogin As frmLogin
Set fLogin = New frmLogin
fLogin.Show vbModal
If fLogin.LoginSucceeded Then
'Here Success of Login
Else
'Failure of Login
End If
'Unload from Memory
Unload fLogin
End Sub