Application.HyperLink vs controlname.HyperlinkAddress

B

Bob Quintal

Any comments on the use of one or the other in a form that opens a
linked file?

or on other methods like fHandleFile by Dev Ashish?

Reason I ask: I need to make some changes in a database originally
created in Access 2, then upgraded to '97 then upsized to a SQL server
back end, and the front end upgraded to Access 2003.

A lot of the code is archaic. some behaves erratically.
 
D

Dirk Goldgar

Bob Quintal said:
Any comments on the use of one or the other in a form that opens a
linked file?

or on other methods like fHandleFile by Dev Ashish?

Reason I ask: I need to make some changes in a database originally
created in Access 2, then upgraded to '97 then upsized to a SQL server
back end, and the front end upgraded to Access 2003.

A lot of the code is archaic. some behaves erratically.


Do you mean "Application.FollowHyperlink"?

Where hyperlinks or file paths to be opened are data -- as opposed to static
links on forms, as for example links to help pages -- I don't use hyperlink
addresses or hyperlink fields as such. I store the URL in a text field and
either use Application.FollowHyperlink or fHandleFile (the Windows
ShellExecute API) to open the URL as appropriate. The reason I don't use
the Hyperlink field type is that editing it becomes complicated, since what
you usually see is the display text, not the actual hyperlink address.

I don't have any strong opinion about whether to use FollowHyperlink or
ShellExecute to follow such a link. My natural inclination would be to use
FollowHyperlink for an http: URL, and ShellExecute to open a file with the
registered application. FollowHyperlink does generally work for that, too;
however, if the filetype can be displayed by the user's web browser, then
FollowHyperlink will usually display it in the web browser rather than the
registered application. So if I really want to guarantee that the file is
opened in the registered application for that filetype, I'll use
ShellExecute rather than FollowHyperlink.
 
B

Bob Quintal

Do you mean "Application.FollowHyperlink"?

Yes, sorry for the confusion.
Where hyperlinks or file paths to be opened are data -- as opposed
to static links on forms, as for example links to help pages -- I
don't use hyperlink addresses or hyperlink fields as such. I
store the URL in a text field and either use
Application.FollowHyperlink or fHandleFile (the Windows
ShellExecute API) to open the URL as appropriate. The reason I
don't use the Hyperlink field type is that editing it becomes
complicated, since what you usually see is the display text, not
the actual hyperlink address.

All my databases use the fHandleFile code. I inherited (I wrote it in
dBase IV, but it's been through many different hands) this one when
the person responsible for maintaining it left the company.
..
The full file path and name is stored in a text field, not a
hyperlink. The continuous form has a command button with on_click
event code that sets the button's .HyperlinkAddress to the string in
the textbox. It works most of the time, but not always. I'd never
seen that method used before, and wondered about other people's
preference in doing it that way instead of the other methods..
I don't have any strong opinion about whether to use
FollowHyperlink or ShellExecute to follow such a link. My natural
inclination would be to use FollowHyperlink for an http: URL, and
ShellExecute to open a file with the registered application.
FollowHyperlink does generally work for that, too; however, if the
filetype can be displayed by the user's web browser, then
FollowHyperlink will usually display it in the web browser rather
than the registered application. So if I really want to guarantee
that the file is opened in the registered application for that
filetype, I'll use ShellExecute rather than FollowHyperlink.
Thanks. The info about opening in the registered application is
appreciated.
 
D

Dirk Goldgar

Bob Quintal said:
The full file path and name is stored in a text field, not a
hyperlink. The continuous form has a command button with on_click
event code that sets the button's .HyperlinkAddress to the string in
the textbox. It works most of the time, but not always. I'd never
seen that method used before, and wondered about other people's
preference in doing it that way instead of the other methods..

It sounds a bit screwy to me, as the operation of the hyperlink is somewhat
independent of Access's processing of the Click event, and might conceivably
be out of sync with it, it seems to me (without testing). If I were going
to do something like that, I would use the button's GotFocus event to set
the HyperlinkAddress. However, I just wouldn't do it that way.

Maybe the database in question was developed in an earlier version of
Access, before the FollowHyperlink method was introduced.
 
B

Bob Quintal

It sounds a bit screwy to me, as the operation of the hyperlink is
somewhat independent of Access's processing of the Click event,
and might conceivably be out of sync with it, it seems to me
(without testing). If I were going to do something like that, I
would use the button's GotFocus event to set the HyperlinkAddress.
However, I just wouldn't do it that way.

Maybe the database in question was developed in an earlier version
of Access, before the FollowHyperlink method was introduced.
The User interface comes from Access 2. I've rewritten the code to
use fHandleFile.

Thanks for your time and knowledge.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top