Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

'Label Not Defined' on error handling procedure 1

Status
Not open for further replies.

bigchuck

Programmer
Oct 10, 2002
14
US
When I run the following code I get a 'Compile Error: Label not found' on the second line:
Private Sub Command68_Click()
'The following line is where the code errors out
On Error GoTo Err_Command68_click

FollowHyperlink Outage_Log

exit_Command68_Click:
DoCmd.CancelEvent
End Sub

Err_Command68:
Select Case Err.Number
Case 490
MsgBox "The requested document does not exist.", , "Message"
Case Else
MsgBox Err.Number & ": " & Err.Description
End Select
Resume exit_Command68_Click
End Sub

I would appreciate any help.

Thanks,
BigChuck
 
Maybe u use a lable to make the hyperlink visible than u need to set Outage_log.caption

else, i have no Idea, but maybe u can tell the format of outage_log, is it a field in a table, an unbound field, or what?

Gerard
 
It is a text control bound to a field with a hyperlink data type. However, when I go to debug it, the line with the text 'on error goto err_command68_click' is highlighted. I have used this syntax alot of times for error handling without any problems.
 
Your code says "On Error GoTo Err_Command68_click",
but there's no label named "Err_Command68_click".
The label on your error-handling code is "Err_Command68".
Change it to "On Error GoTo Err_Command68".
 
Oops...that was just a typo. In the actual code it is correct and it still errors out.
 
In the code that says

exit_Command68_Click:
DoCmd.CancelEvent
End Sub

I believe you need "Exit Sub", not "End Sub". The
reason you're getting 'Label not found' on the second line
is 'cause the compiler doesn't see the rest of the routine
after the "End Sub". It thinks your subroutine ends at
that point, so it isn't reading far enough to see the label
you're referring to.
 
Thanks alot, mikevh. That was the problem. I just tripped over that even though I looked at it a million times.
 
How many times have we all done stuff like that?
Sometimes it just takes another set of eyes.
Glad to help out.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top