Solved

Launching Hyperlinks from Microsoft Access

Posted on 2013-01-15
7
266 Views
Last Modified: 2013-01-23
We have an Access Application where we are saving hyperlinks to documents.  For tif, jpg, etc documents, the hyperlinks are opening up to a viewer.  We would like to have these files open up in MS Paint.

Is there a way to code this into the application?
0
Comment
Question by:btgtech
  • 4
  • 3
7 Comments
 
LVL 28

Expert Comment

by:omgang
ID: 38779688
Tested in Access 2007 on Windows 7
OM Gang

Public Function TestShell()
On Error GoTo Err_TestShell

    Dim varReturn

    varReturn = Shell("c:\Windows\system32\mspaint.exe f:\temp\outlookfind1.jpg", vbNormalFocus)

Exit_TestShell:
    Exit Function

Err_TestShell:
    MsgBox Err.Number & " (" & Err.Description & ") in procedure TestShell of Module Module3"
    Resume Exit_TestShell
   
End Function
0
 

Author Comment

by:btgtech
ID: 38780071
Does anything need to change in the hyperlink?
0
 
LVL 28

Accepted Solution

by:
omgang earned 500 total points
ID: 38780117
If the hyperlink is currently a UNC path such as J:\SomeFolder\SomeSubFolder\ImageFile.gif then no you don't need to change the hyperlink.  Assuming the control on the form is named HLink you could code a command button something like this

Private Sub Command1_Click()
'open the file specified in the HLink control using MS Paint
On Error GoTo Err_Command1_Click

    Dim strCommand As String

    strCommand = "c:\Windows\System32\mspaint.exe " & Me.HLink
    Call Shell(strCommand)

Exit_Command1_Click:
    Exit Sub

Err_Command1_Click:
    MsgBox Err.Number & ", " & Err.Description, , "Error"
    Resume Exit_Command1_Click

End Sub

OM Gang
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 28

Expert Comment

by:omgang
ID: 38780124
It may help to post the current code/macro/event procedure for how the hyperlinks are being opened now.
OM Gang
0
 

Author Comment

by:btgtech
ID: 38780138
The App currently uses the functionality available when a field type of Hyperlink is used.
0
 
LVL 28

Expert Comment

by:omgang
ID: 38780172
So what value is stored in the field?  Just the file name or a UNC path as in my example?
OM Gang
0
 

Author Comment

by:btgtech
ID: 38780188
It is the UNC path, so I will try the above Function.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now