Re: an exception for GoTos?
Quote:
I actually use something very simliar to what you posted - but rather than have a goto I just let it fall out of the if's.. although in the situation in your example you need a variable to keep track of whether to do the following code or not.
VB Code:
Private Sub MySub()
Dim rs As ADODB.Recordset
Dim rs2 As ADODB.Recordset
Dim FallOut as Boolean
Set rs = New ADODB.Recordset
Set rs2 = New ADODB.Recordset
If ([i]some condition[/i]) Then
If ([i]another condition[/i]) Then
'do something
Else
FallOut = True
' GoTo CleanUp
End If
Else
'do something else
End If
If Not(FallOut) Then
'Do some more code
End If
CleanUp:
Set rs = Nothing
Set rs2 = Nothing
End Sub