Adding Hyperlinks Programmatically

R

renee rieser

Hi All,

I'm looking for a way to add hyperlinks programmatically.

Ideally, it would work as follows, but any user-friendly alternatives
would be most welcome....

The user clicks on a button which opens a "Windows Explorer" type
window. The user then browses to the url, directory, or file they wish
to add, selects it, and a hyperlink to the item is added to the
current record.

Any suggestions?

Many thanks in advance,
Renee




PS. I just posted this a few moments ago in
microsoft.public.office.access.formscoding but, browsing, this forum
seems much more active, so sorry in advance if my repost (crosspost?)
is a problem.
 
J

John Nurick

Hi Renee,

Assuming you have a table that contains a field of type Hyperlink, and a
form with a textbox bound to that field, let's call the textbox
txtHyper.

All your button basically needs to do is something like this:

Me.Controls("txtHyper").SetFocus
Docmd.RunCommand acCmdEditHyperlink
 
B

benyod79 via AccessMonster.com

Are you looking to add hyperlinks to websites or hyperlinks to open
files/directories on your pc? In either case I'd suggest using a text field
rather than hyperlink.

files/directories: try this link:
http://www.mvps.org/access/api/api0001.htm . Then on your form make a button
test this field for a value. If it's null, the open file dialog opens. If
it's not null use ".followhyperlink" to open the file/directory.

websites: not sure, but you'll probably have to add some button in your
explorer window to send the url back to the access field. Or, just a
suggestion, right-click over the url, click copy, then in Access make a
button that pastes that value into your field thus eliminating the right-
click-paste again.
 
Top