Solved

Launching Hyperlinks from Microsoft Access

Posted on 2013-01-15
7
275 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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

863 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

24 Experts available now in Live!

Get 1:1 Help Now