Object related errorcode

F

frank knuckles

I often see this kind of code:
Exit_btnOK_Handler:
Exit Sub
Err_btnOK_Handler:
MsgBox Err.Description
Resume Exit_btnOK_Handler

While the following generic code is easier to use in other subs or
functions:
Exit_Handler:
Exit Sub
Err_Handler:
MsgBox Err.Description
Resume Exit_Handler

What's best to use?
Thanks.

FK
 
D

Douglas J. Steele

Not sure you can really say one's better than the other.

I believe labels needed to be unique in Access Basic, so that the first
option was mandatory. Now that labels only need to be unique in their
procedure, there's no reason not to use the second option. They both do
exactly the same thing, though.
 
F

frank knuckles

Thanks Douglas.

Douglas J. Steele said:
Not sure you can really say one's better than the other.

I believe labels needed to be unique in Access Basic, so that the first
option was mandatory. Now that labels only need to be unique in their
procedure, there's no reason not to use the second option. They both do
exactly the same thing, though.
 
Top