Whilst in the form load - is there an easy way to cancel the form load? If i try to unload it I get an exception.
Printable View
Whilst in the form load - is there an easy way to cancel the form load? If i try to unload it I get an exception.
Try:
Code:Exit Sub
If you exit the sub the form still loads I want to cancel the form load.
you can't, you lhave to prevent it from loading.
Option Explicit
Dim x, y
Private Sub Form_Load()
Dim x
x = y
If x = y Then
Unload Me
Else
MsgBox "MI"
'bla abl
End If
End Sub
Wouldn't it just be:
Code:Private Sub Form_Load()
'If cancelled then...
Unload Me
Set Form1 = Nothing
End
'End If
End Sub