UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Button On A Form Contains A Hyperlink, Access 2016    
 
   
InfoHound
post Dec 19 2017, 01:06 PM
Post#1



Posts: 1,061
Joined: 1-December 12



I have a Continuous Form that I'd like to add a button to that brings you to a company's website.

The only reason I want to do it this way is for aesthetics

The button would have the same label for each record "Co. Website" but would contain the hyperlink for each individual record on the form that is supplied by the forms underlying query.

When the user clicks on the button it would bring them to the company's website.
Go to the top of the page
 
theDBguy
post Dec 19 2017, 01:23 PM
Post#2


Access Wiki and Forums Moderator
Posts: 71,408
Joined: 19-June 07
From: SunnySandyEggo


Hi,

What is the question? If the URL is available, you should be able to use the button's Click event to navigate to it. Right?

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Microsoft Access MVP | Access Website | Access Blog | Email
Go to the top of the page
 
InfoHound
post Dec 19 2017, 01:32 PM
Post#3



Posts: 1,061
Joined: 1-December 12



If the field in the query is named CoWebSite.

In the On Click Event I would:

Private Sub btnCoWebSite_Click()
Application.FollowHyperlink Me.CoWebSite
End Sub

Tried this but it didn't work.

Go to the top of the page
 
GroverParkGeorge
post Dec 19 2017, 01:38 PM
Post#4


UA Admin
Posts: 31,598
Joined: 20-June 02
From: Newcastle, WA


Should work. What is the exact content of one of those hyperlink fields? How is defined?

--------------------
Go to the top of the page
 
LPurvis
post Dec 19 2017, 01:41 PM
Post#5


UtterAccess Editor
Posts: 16,091
Joined: 27-June 06
From: England (North East / South Yorks)


Hi

I hate FollowHyperlink.
I'll just leave that there. :-)

ShellExecute (or the wrapping fHandleFile found http://access.mvps.org/access/api/api0018.htm) is much more robust IMNSHO. :-)

Cheers

--------------------
Go to the top of the page
 
InfoHound
post Dec 19 2017, 05:03 PM
Post#6



Posts: 1,061
Joined: 1-December 12



Shell command looks good.

i can't get the button to work. If I use the hyperlink I don't have any problems , but , the button won't work.

Here's the code (its changed a bit)

CODE
Private Sub clkCoSite_Click()
Dim txtCoSite As String
txtCoSite = Me.Website
Application.FollowHyperlink txtCoSite


What I'm trying to do is create a continuous form that will allow me to click on buttons that will open up different websites relating to mining companies.
Like I said the hyperlink control does the job fine, however, I was hoping to make the form look better by using buttons to open the various sites.

George: This is what I see when I debug txtCoSite: #http://www.aberdeeninternational.ca/#
The hyperlink field is: http://www.aberdeeninternational.ca/
This post has been edited by InfoHound: Dec 19 2017, 05:06 PM
Go to the top of the page
 
theDBguy
post Dec 19 2017, 05:45 PM
Post#7


Access Wiki and Forums Moderator
Posts: 71,408
Joined: 19-June 07
From: SunnySandyEggo


Hi,

Try changing your code to this and see what happens.

Application.FollowHyperlink Mid(PlainText(Me.CoWebsite),2)

Hope it helps...

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Microsoft Access MVP | Access Website | Access Blog | Email
Go to the top of the page
 
InfoHound
post Dec 28 2017, 04:08 PM
Post#8



Posts: 1,061
Joined: 1-December 12



Thanks Again TheDBGuy!

This works perfect!


Happy Holidays to all and many many thanks for all your help again this year UtterAccess and cheers the great people who help us out!
Go to the top of the page
 
theDBguy
post Dec 28 2017, 04:23 PM
Post#9


Access Wiki and Forums Moderator
Posts: 71,408
Joined: 19-June 07
From: SunnySandyEggo


Hi,

You're welcome. Glad to hear you got it sorted out.

Merry Christmas and a Happy New Year!

cheers.gif

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Microsoft Access MVP | Access Website | Access Blog | Email
Go to the top of the page
 
tina t
post Dec 28 2017, 04:41 PM
Post#10



Posts: 5,215
Joined: 11-November 10
From: SoCal, USA


QUOTE
Thanks Again TheDBGuy!

This works perfect!

fyi, another option is to store URLs in a plain text field in your table, rather than in a field with DataType of Hyperlink. if you'll be using code to go to website(s), there's no need to store the value as an actual hyperlink - and no need to write code to "convert" it back to plain text.

hth
tina

--------------------
"you can't take the sky from me"
Go to the top of the page
 
LPurvis
post Dec 29 2017, 01:19 PM
Post#11


UtterAccess Editor
Posts: 16,091
Joined: 27-June 06
From: England (North East / South Yorks)


^ Yes, this. ;-)

Cheers

--------------------
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    19th January 2018 - 02:46 AM