Solved

Launching Hyperlinks from Microsoft Access

Posted on 2013-01-15
7
282 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
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

776 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