?
SolvedPrivate

Hyperlink control in Access

Posted on 2014-11-12
7
Medium Priority
?
39 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
[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
  • 2
  • 2
  • 2
7 Comments
 
LVL 38

Accepted Solution

by:
PatHartman earned 2000 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 48

Expert Comment

by:Dale Fye
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
Industry Leaders: 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!

 
LVL 38

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 48

Expert Comment

by:Dale Fye
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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
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…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
Suggested Courses

770 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