By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,850 Members | 990 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,850 IT Pros & Developers. It's quick & easy.

Clicking on Hyperlink question

P: n/a
If I create a field as a hyperlink, Access will open the hyperlink if I
single click it.

Is there a method within the operating system that would tell access to
only open the hyperlink if double-clicked? Is there anything I can do
so that Access will open a hyperlink on a double-click?

I find opening a hyperlink on a single click annoying. One reason I
find it annoying is that I can't single click and then right click to
edit/update the hyperlink field via a short-cut menu. Access wants to
open the field and external program up immediately.

I have been using HyperlinkPart so I can control the single click and I
can shade the control as underline and blue to simulate a hyperlink.
This works fine in continuous forms but the underline and blue
foreground disappear if it is a datasheet (I am using A97). In this
instance I want to use a datasheet.
Nov 13 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Salad wrote:
If I create a field as a hyperlink, Access will open the hyperlink if I
single click it.


I guess there isn't a solution. The developers at Microsoft had a brain
fart when they decided to implement hyperlinks into Access.
Nov 13 '05 #2

P: n/a
Salad wrote:
Salad wrote:
If I create a field as a hyperlink, Access will open the hyperlink if
I single click it.


I guess there isn't a solution. The developers at Microsoft had a brain
fart when they decided to implement hyperlinks into Access.


hehe, just the one?

how about a textbox, underlined and blue with a doubleclick event
=RunFile([TextBox])

Code below...
not sure of origin, not mine you can tell by lack of naming conventions
and exit functions all over the place.
--- code start ---
Declare Function WinAPI_ShellExecute Lib "shell32.dll" Alias
"ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal
lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As
String, ByVal nShowCmd As Long) As Long

Function RunFile(pstrShell As String, Optional pstrWhat As String,
Optional pvarRunStyle As Variant, Optional pstrParam As String)
Dim runstyle As String, workdirpath As String, FilePath As String
Dim success As Variant

If IsMissing(pvarRunStyle) Then
runstyle = "1" 'Run it normally, in a window
Else
runstyle = pvarRunStyle
End If
'workdirpath = GetPath(strshell) 'define working directory
FilePath = pstrShell ' and the document or exe, with path
If Len(pstrParam) Then
success = WinAPI_ShellExecute(0, pstrWhat, FilePath, pstrParam,
workdirpath, runstyle)
Exit Function
End If
If Len(pstrWhat) Then
success = WinAPI_ShellExecute(0, pstrWhat, FilePath,
vbNullString, workdirpath, runstyle)
Else
success = WinAPI_ShellExecute(0, vbNullString, FilePath,
vbNullString, workdirpath, runstyle)
End If
RunFile = success

End Function
--- code end ---

--
Pretentious? Moi?
Nov 13 '05 #3

P: n/a
On Wed, 06 Oct 2004 22:19:28 +0100, Trevor Best <nospam@localhost>
wrote:
Salad wrote:
Salad wrote:
If I create a field as a hyperlink, Access will open the hyperlink if
I single click it.


I guess there isn't a solution. The developers at Microsoft had a brain
fart when they decided to implement hyperlinks into Access.


hehe, just the one?

how about a textbox, underlined and blue with a doubleclick event
=RunFile([TextBox])

Code below...
not sure of origin, not mine you can tell by lack of naming conventions
and exit functions all over the place.
--- code start ---
Declare Function WinAPI_ShellExecute Lib "shell32.dll" Alias
"ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal
lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As
String, ByVal nShowCmd As Long) As Long

Function RunFile(pstrShell As String, Optional pstrWhat As String,
Optional pvarRunStyle As Variant, Optional pstrParam As String)
Dim runstyle As String, workdirpath As String, FilePath As String
Dim success As Variant

If IsMissing(pvarRunStyle) Then
runstyle = "1" 'Run it normally, in a window
Else
runstyle = pvarRunStyle
End If
'workdirpath = GetPath(strshell) 'define working directory
FilePath = pstrShell ' and the document or exe, with path
If Len(pstrParam) Then
success = WinAPI_ShellExecute(0, pstrWhat, FilePath, pstrParam,
workdirpath, runstyle)
Exit Function
End If
If Len(pstrWhat) Then
success = WinAPI_ShellExecute(0, pstrWhat, FilePath,
vbNullString, workdirpath, runstyle)
Else
success = WinAPI_ShellExecute(0, vbNullString, FilePath,
vbNullString, workdirpath, runstyle)
End If
RunFile = success

End Function
--- code end ---

--
Pretentious? Moi?


Hi
What about the bookmark parts, and the links to objects in Office such
as tables?
You can parse the original hyperlink which is really a memo field
into three parts separated by # signs, representing the local path,
full path and bookmark.
More work needed here!

The problem is the requirement for datasheet view, which exposes the
hyperlink to clicks, or requires you to provide another data type and
duplicating quite a lot of functionality, including the ability to
load the field from a toolbar button. I thought of using a continuous
form and setting the cursor movements to simulate datasheets, or
subclassing the whole form and intercepting mouse clicks .... all too
difficult. Maybe there is a simple way.
David

Nov 13 '05 #4

P: n/a
Trevor Best wrote:
Salad wrote:
Salad wrote:
If I create a field as a hyperlink, Access will open the hyperlink if
I single click it.

I guess there isn't a solution. The developers at Microsoft had a
brain fart when they decided to implement hyperlinks into Access.

hehe, just the one?


Thanks Trevor. Yes, I went with a textbox, underlined and blue. I have
been using a routine I found at MVPS a couple years ago for opening the
file (link) maximized. I appreciate the time you spent to post your code.

I guess my complaint with hyperlinks (not using HyperlinkPart or
whatever) is that 1) it has a single click. If you single click on the
field, that opens an external program that may be slow in loading. 2)
You can't edit the display text or hyperlink easily since if you go into
the field, it opens the link before you can edit. 3) It minimizes
Access that adds more work to end users. 4) A hyperlinkpart is not
displayed as a hyperlink color in a datasheet.

It's as if MS went out of its way to ensure the developer has absolutely
no control over hyperlinks. And that I am forced to use continuous
forms and use options like HyperlinkPart and code like yours to make it
work correctly.

Regarding hyperlinks...I am glad MS provided them. As far as their
implementation, I give them an F. And I put the responsibility of
failing onto the MS Access project manager. If a guy like the PM is
impressed by the coding cowboys, he/she won't pay attention to the
usefulness. That is why I firmly believe the PMs should have some
real-world experience.


how about a textbox, underlined and blue with a doubleclick event
=RunFile([TextBox])

Code below...
not sure of origin, not mine you can tell by lack of naming conventions
and exit functions all over the place.
--- code start ---
Declare Function WinAPI_ShellExecute Lib "shell32.dll" Alias
"ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal
lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As
String, ByVal nShowCmd As Long) As Long

Function RunFile(pstrShell As String, Optional pstrWhat As String,
Optional pvarRunStyle As Variant, Optional pstrParam As String)
Dim runstyle As String, workdirpath As String, FilePath As String
Dim success As Variant

If IsMissing(pvarRunStyle) Then
runstyle = "1" 'Run it normally, in a window
Else
runstyle = pvarRunStyle
End If
'workdirpath = GetPath(strshell) 'define working directory
FilePath = pstrShell ' and the document or exe, with path
If Len(pstrParam) Then
success = WinAPI_ShellExecute(0, pstrWhat, FilePath, pstrParam,
workdirpath, runstyle)
Exit Function
End If
If Len(pstrWhat) Then
success = WinAPI_ShellExecute(0, pstrWhat, FilePath,
vbNullString, workdirpath, runstyle)
Else
success = WinAPI_ShellExecute(0, vbNullString, FilePath,
vbNullString, workdirpath, runstyle)
End If
RunFile = success

End Function
--- code end ---

Nov 13 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.