SolvedPrivate

Hyperlink control in Access

Posted on 2014-11-12
7
34 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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
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…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

911 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

22 Experts available now in Live!

Get 1:1 Help Now