SolvedPrivate

Hyperlink control in Access

Posted on 2014-11-12
7
32 Views
Last Modified: 2016-02-10
Hi,

I have a hyperlink field in a table.
I created a data entry form based on the table.
When I click in the hyperlink control in the form, I need it to open Windows Explorer to locate the file that the hyperlink points to.
I would prefer to do this using a macro as I am not experienced in VBA.
Thanks
0
Comment
Question by:SalmaYK
  • 2
  • 2
  • 2
7 Comments
 
LVL 34

Accepted Solution

by:
PatHartman earned 500 total points
ID: 40438434
I would recommend changing the field to a short text data type.  The Hyperlink data type is specific to Access and cannot be upsized.

The code to "open" a hyperlink from a text control is:

Application.FollowHyperlink Me.yourtextfield

This method works for web pages, email addresses, and any file whose file type is registered.  So

Application.FollowHyperlink "C:\Data\somespreadsheet.xlsx"  
will open the specified spreadsheet.

I don't know if the Hyperlink data type limits you to just web pages because I don't use it but it may.
0
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 40438465
No points please.  I strongly agree with Pat regarding changing the data type of that field from hyperlink to text.  In addition to any potential upsizing issues, simply clicking in the control can launch the hyperlink, rather than allowing you to edit the text.  I generally use a textbox, with a command button (use the image of the World with chain on the button), and use the FollowHyperlink method described above in the click event of that button.

It is also difficult to query hyperlink fields, as they contain all sorts of extraneous html codes which get in the way.
0
 

Author Comment

by:SalmaYK
ID: 40438471
ok..
but I do want to open the hyperlink once it is entered if I click on it.
For data entry purposes, I need to be able to search for the location of the file on my hard drive (not a website).
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 34

Expert Comment

by:PatHartman
ID: 40438527
I showed you the code in my previous post.  It's a one liner.  Just put it in the double click event of the field.  Using the click event will interfere with editing the value.
0
 

Author Comment

by:SalmaYK
ID: 40438702
ah.. that was it
Thanks!.
0
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 40439090
But I think you got the answer wrong.  Pat is the one that provided your solution, I just piled on, and asked for no points.

Please reopen this thread (click the Request Attention text in the bottom right corner of your original post).  Then ask the moderators in the text box provided to reopen the question for re-allocation of points.

Dale
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Modern/Metro styled message box and input box that directly can replace MsgBox() and InputBox()in Microsoft Access 2013 and later. Also included is a preconfigured error box to be used in error handling.
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Familiarize people with the process of utilizing SQL Server functions 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 Microsoft Ac…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

757 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

23 Experts available now in Live!

Get 1:1 Help Now