What that code does is this:
Code:
Private Sub Command75_Click()
For command button Command75, does this when the button is clicked.
Code:
On Error GoTo PROC_ERR
Sets a trigger so that any error that is encountered will send the computer to the spot called PROC_ERR.
Code:
PROC_ERR:
MsgBox "Sorry No Family File Available"
Names THIS spot PROC_ERR, and pops up a message box.
Code:
On Error Resume Next
Changes the trigger so that any more errors will just continue at the next line.
Code:
Me.Code2.SetFocus
FollowHyperlink Code2
Sets the active control to be the control called code2, then follows the hyperlink that's supposed to be in code2.
Ends the subroutine.
That code is executed in order, so it will always pop the message box, before even attempting to open the hyperlink.
What I think you really want is something more like this.
Code:
Private Sub Command75_Click()
On Error GoTo Err_Command75_Click
Me.Code2.SetFocus
FollowHyperlink Code2
Exit_Command75_Click:
Exit Sub
Err_Command75_Click:
If Err.Number = 490 Then
MsgBox "Sorry No Family File Available"
Resume Exit_Command75_Click
Else
MsgBox Err.Description
Resume Exit_Command75_Click
End If
End Sub
NOTES -
1) I've renamed the error landing spot so that it's associated with the command button.
2) I've moved it after the exit, so that it won't go off unless there's an error raised.
3) I'm testing for the "missing link" error, and giving that message only when that particular error is raised. I believe the error for missing hyperlink is 490. I may be wrong. If you run the above code once with a record you know has no family file, then look at the error number and put it in the place where I have the number 490 in the above code, then you should be good. Feel free to make it a list ""If Err.Number = 490 OR 491 OR 492 etc" if you find there are a couple of different possible errors due to missing files.