Solved

Launching Hyperlinks from Microsoft Access

Posted on 2013-01-15
7
306 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
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…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

622 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