I am intrigued by this one when you say it works now because it should not.
One problem I can see with the code is that you have an End Sub directly after the Exit_Command1:, this should be an 'Exit Sub 'not and 'End Sub'
So your code should read
Private Sub Command1()
On Error GoTo Err_Command1
DO CODE
Exit_Command1:
Exit Sub 'Not end sub
Err_Command1: ' This is the label
Msgbox err.description
Resume Exit_Command1
End Sub
If you left it as as 'end sub' you would get an error stating
'Compile error Label not defined'
this is because the error label, and code following it' is effectivly outside the procedure. The 'End sub' terminates the sub.
To test this you can use the following
Private Sub Command1()
Dim a As Integer
On Error GoTo Err_Command1
Err.Raise 6
Exit_Command1:
Exit Sub
Err_Command1:
MsgBox Err.Description
Resume Exit_Command1
End Sub
Where 'err.raise 6' forces an overflow error condition.
This should work
If you know change the exit sub to end sub and try to either compile the module or run it you will get the 'label not defined message'
This applies to 97 I am not sure about 2000.
Note to other users who may not know about the err.raise this can be very useful for testing err handling in procedures simply assign the erro number you want to test to the err.raise.
Hope this helps
Regards
Trevor from
www.accesswatch.co.uk