Button to go to URL in form (1 Viewer)

matt467

Registered User.
Local time
Today, 03:42
Joined
Sep 2, 2009
Messages
12
Ive got a form with a few Text Box's in it with one of them with the customers website and another with their email, is it possible to put a button beside it to go to the website or email

Like i can click the button and go to whatever is written in the text box its linked onto
 

boblarson

Smeghead
Local time
, 19:42
Joined
Jan 12, 2001
Messages
32,059
Have you tried:

FollowHyperlink Me.YourTextBoxNameHere
 

matt467

Registered User.
Local time
Today, 03:42
Joined
Sep 2, 2009
Messages
12
As an expression or code?
 

boblarson

Smeghead
Local time
, 19:42
Joined
Jan 12, 2001
Messages
32,059
As code in the VBA window for the click event of the button.
 

matt467

Registered User.
Local time
Today, 03:42
Joined
Sep 2, 2009
Messages
12
Got it for hyperlink, now just need to work it out for an email address to open up a new email to the address thats in a text box
 

boblarson

Smeghead
Local time
, 19:42
Joined
Jan 12, 2001
Messages
32,059
It should work for an email address too. So, if an email address is in there, like

x@zzz.com

then

FollowHyperlink Me.TextBoxNameHere

should open an email to x@zzz.com
 

matt467

Registered User.
Local time
Today, 03:42
Joined
Sep 2, 2009
Messages
12
Nah first it comes up with a security error, then after i click yes to continue it comes up with a runtime error 490
 

boblarson

Smeghead
Local time
, 19:42
Joined
Jan 12, 2001
Messages
32,059
Are you storing the email address as a hyperlink or just as the email address in text?
 

matt467

Registered User.
Local time
Today, 03:42
Joined
Sep 2, 2009
Messages
12
In the table that the form links to, both fields are under Text, but the website one works under text

And the data in the field is a valid email address, mail@address.com
 

boblarson

Smeghead
Local time
, 19:42
Joined
Jan 12, 2001
Messages
32,059
You could try this:
Code:
Dim strPath As String

strPath = Me.YourTextBoxNameHere

If Instr(1, strPath, "@", vbTextCompare) > 0 Then
   strPath = "MailTo:" & strPath
End If

Application.FollowHyperlink strPath
 

sailinxtc

Registered User.
Local time
, 21:42
Joined
Apr 27, 2008
Messages
34
I have a related question...

I am using Application.FollowHyperlink txtURL with a button and a text box named txtURL

I have set a default URL in the properties for the textbox

I used the button property on click event procedure to call Application.FollowHyperlink txtURL

This works well but would like to have the last entered URL in the textbox remembered if the user enteres something different, this would be done with the Button on click event procedure.

In other words it would just remember the one URL or last one that was actaully visited after it was entered in the textbox on button on click happens.

should be fairly simple but not sure how to set it each time etc...

Thanks in advance...
 

Users who are viewing this thread

Top Bottom