code fails, then you do not want to show the form. If you call "Unload ME", you will get an error in the form that called ".Show" of the form loading, saying that the form is already unloaded.
Private mbCancelForm As Boolean
Private Sub Form_Activate()
If mbCancelForm = True Then Unload Me
End Sub
Private Sub Form_Load()
mbCancelForm = False
If {SomeCondition} = True Then
MsgBox "False condition, unable to load the form", vbExclamation + vbOKOnly
mbCancelForm = True
End If
End Sub
No comments:
Post a Comment