Trapping External Errors from hyperlink text fields

rzielins

Registered User.
Local time
Today, 15:36
Joined
May 2, 2001
Messages
13
I know how to trap standard MS Access errors where the error trapping code searches for a particular MS Access error number. However, how do you get a list of all possible MS Windows error codes so that external events can be trapped and resolved.

My specific problem involves atext field that is defined in the Table as a hyperlink TYPE. I have a hyperlink field on my form that stores the PATH to a document ie. c:\my documents\thanks.doc When this document is moved or deleted and the User clicks on the outdate of hyperlinked file address, Access returns with the following message :

"Unable to open c:\my documents\thanks.doc. Cannot open specified file.
I have tried trapping the error using On Error in the On Click event but the error must be external to Access. I have looked at the Raise Method but can't seem to find a way to trap the error message.

I would like to trap this error so I can display a more informative warning to the user. How is this achieved? Any help as always is greatly appreciated.
 
Try this

Change your table so that it's just Text, not a Hyperlink Type
You may have to remove the #'s that decorate your text following this data type conversion.

Put an invisible label on the form.

Put the following code on the On_Click event of your TextBox

If Dir(Me!TextBoxName.Text)="" then
'Error handling messages

Else
Me!LabelName.Hyperlink.Address=Me!TextBoxName.Text
Me!LabelName.Hyperlink.Follow

End If
 
Last edited:
Thanks for the advice - works a treat!
Rob
 

Users who are viewing this thread

Back
Top Bottom