SolvedPrivate

Hyperlink control in Access

Posted on 2014-11-12
7
36 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 36

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
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 
LVL 36

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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

821 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