From: coffent on
Using Windows XP Control Panel / Folder Options / File Types, I have set the
"pdf" extension association to another pdf file viewer than Adobe Acrobat.
This works fine in all programs other than Access. For example, if I
double-click on a file with a pdf extension in Windows Explorer, it opens it
with the third-party viewer. However, if I create a hyperlink to that same
file in Access it is listed as "Acrobat Document" and if I double-click it,
Access ignores my file association and opens it with Adobe Acrobat. Is there
a way to get Access to honor the Windows file associations?
From: Dorian on
Set the file associations in your browser.
The internet is not in the Windows world.
-- Dorian
"Give someone a fish and they eat for a day; teach someone to fish and they
eat for a lifetime".


"coffent" wrote:

> Using Windows XP Control Panel / Folder Options / File Types, I have set the
> "pdf" extension association to another pdf file viewer than Adobe Acrobat.
> This works fine in all programs other than Access. For example, if I
> double-click on a file with a pdf extension in Windows Explorer, it opens it
> with the third-party viewer. However, if I create a hyperlink to that same
> file in Access it is listed as "Acrobat Document" and if I double-click it,
> Access ignores my file association and opens it with Adobe Acrobat. Is there
> a way to get Access to honor the Windows file associations?
From: BruceM via AccessMonster.com on
I don't think there was a question about the internet. The OP mentioned
"Windows Explorer", which is another name for My Computer. Perhaps you read
it as Intenet Explorer, or maybe I just missed something.

To the OP, this code may help. I have used a version of it, but I altered it
for some special circumstances. I think this is the original version. I
found it in a newsgroup posting. The link to the original source is no
longer active.

'Original Source: http://www.pacificdb.com.au/MVP/Code/ExeFile.htm
Public Const SW_HIDE = 0
Public Const SW_MINIMIZE = 6
Public Const SW_RESTORE = 9
Public Const SW_SHOW = 5
Public Const SW_SHOWMAXIMIZED = 3
Public Const SW_SHOWMINIMIZED = 2
Public Const SW_SHOWMINNOACTIVE = 7
Public Const SW_SHOWNA = 8
Public Const SW_SHOWNOACTIVATE = 4
Public Const SW_SHOWNORMAL = 1


Public Declare Function 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


Public Sub ExecuteFile(sFileName As String, sAction As String)
Dim vReturn As Long
'sAction can be either "Open" or "Print".

If ShellExecute(Access.hWndAccessApp, sAction, sFileName, vbNullString,
"", SW_SHOWNORMAL) < 33 Then
DoCmd.Beep
MsgBox "File not found."
End If
End Sub

You would use it like:

ExecuteFile("http://www.YourURL.com","open")


This is the variant I used, where strFullpath is a UNC network path to a file.
I was interested only in opening the file, so I changed the arguments.

Public Sub ExecuteFile(strFullpath As String)

Dim strFilename As String
Dim strPath As String
Dim strArray() As String

strArray = Split(strFullpath, "\", -1, vbTextCompare)

strFilename = strArray(UBound(strArray))

strPath = Left(strFullpath, Len(strFullpath) - Len(strFilename))

If ShellExecute(Access.hWndAccessApp, "open", strFilename, _
vbNullString, strPath, SW_SHOWNORMAL) < 33 Then
DoCmd.Beep
MsgBox "File not found."
End If

End Sub


Dorian wrote:
>Set the file associations in your browser.
>The internet is not in the Windows world.
>-- Dorian
>"Give someone a fish and they eat for a day; teach someone to fish and they
>eat for a lifetime".
>
>> Using Windows XP Control Panel / Folder Options / File Types, I have set the
>> "pdf" extension association to another pdf file viewer than Adobe Acrobat.
>[quoted text clipped - 4 lines]
>> Access ignores my file association and opens it with Adobe Acrobat. Is there
>> a way to get Access to honor the Windows file associations?

--
Message posted via http://www.accessmonster.com

From: coffent on
I don't understand your suggestion, since Access isn't using the internet.
Both the program and hyperlinked file are on my local drive. Nevertheless
(as stranger things have happened!) I tried setting the association in my
browser, but it made no difference. Access still opens the file with Adobe.

"Dorian" wrote:

> Set the file associations in your browser.
> The internet is not in the Windows world.
> -- Dorian
> "Give someone a fish and they eat for a day; teach someone to fish and they
> eat for a lifetime".
>
>
> "coffent" wrote:
>
> > Using Windows XP Control Panel / Folder Options / File Types, I have set the
> > "pdf" extension association to another pdf file viewer than Adobe Acrobat.
> > This works fine in all programs other than Access. For example, if I
> > double-click on a file with a pdf extension in Windows Explorer, it opens it
> > with the third-party viewer. However, if I create a hyperlink to that same
> > file in Access it is listed as "Acrobat Document" and if I double-click it,
> > Access ignores my file association and opens it with Adobe Acrobat. Is there
> > a way to get Access to honor the Windows file associations?
From: David W. Fenton on
=?Utf-8?B?Y29mZmVudA==?= <coffent(a)discussions.microsoft.com> wrote
in news:7AA10DDD-2E7C-44C4-A3A8-6E28A79645B3(a)microsoft.com:

> Using Windows XP Control Panel / Folder Options / File Types, I
> have set the "pdf" extension association to another pdf file
> viewer than Adobe Acrobat. This works fine in all programs other
> than Access. For example, if I double-click on a file with a pdf
> extension in Windows Explorer, it opens it with the third-party
> viewer. However, if I create a hyperlink to that same file in
> Access it is listed as "Acrobat Document" and if I double-click
> it, Access ignores my file association and opens it with Adobe
> Acrobat. Is there a way to get Access to honor the Windows file
> associations?

I would look carefully at the defined file associations. My guess is
there's something else defined that is overriding it.

You could also test what the apiShellExecute API code does with it:

http://www.mvps.org/access/api/api0018.htm

The other thing that's important is to realize that Access hyperlink
fields are problematic, and in my opinion, not worth the trouble.
It's just a special case of a memo field (in order to handle links
longer than 255 characters), and I tend not to use them at all,
precisely because of this kind of unpredictability, as well as the
complications of editing them.

I can't say that converting your hyperlink to a plain memo field
will fix the problem, but it is something I'd do, anyway. It does
mean you then have to write code to open the hyperlinks, though. But
that also gives you control over what happens.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
 |  Next  |  Last
Pages: 1 2
Prev: langue française Merci
Next: français