Solved

Launching Hyperlinks from Microsoft Access

Posted on 2013-01-15
7
300 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
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your 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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
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…
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…

739 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