How to open a URL via Firefox in access form (2 Viewers)

Gasman

Enthusiastic Amateur
Local time
Today, 10:02
Joined
Sep 21, 2011
Messages
14,319
I have mentioned this in the past in another thread. :(

YOU are not helping yourself with all these one liners. :(
If YOU cannot be bothered to put in any effort, then neither can I.?

You do not even say what url your are trying to access? :(
It is telling you it cannot connect to the server, so the code looks like to be working?, just that the url is suspect.?
However you do not show the code or the value being used? :(

If you do not start supplying relevant information for your problems, I for one, and perhaps others are just going to give up, and help someone else who is prepeared to put some effort in.

Up to you.
Unfollow me by all means.

Edit:
You since posted
Code:
Private Sub View_URL_Click()
Application.FollowHyperlink "http://" & Value_Source
End Sub

what is the value of Value_Source?
I cannot believe you even have a control name called that? :(
 

cayham86

Member
Local time
Today, 10:02
Joined
Jun 30, 2022
Messages
54
I have mentioned this in the past in another thread. :(

YOU are not helping yourself with all these one liners. :(
If YOU cannot be bothered to put in any effort, then neither can I.?

You do not even say what url your are trying to access? :(
It is telling you it cannot connect to the server, so the code looks like to be working?, just that the url is suspect.?
However you do not show the code or the value being used? :(

If you do not start supplying relevant information for your problems, I for one, and perhaps others are just going to give up, and help someone else who is prepeared to put some effort in.

Up to you.
Unfollow me by all means.

Edit:
You since posted
Code:
Private Sub View_URL_Click()
Application.FollowHyperlink "http://" & Value_Source
End Sub

what is the value of Value_Source?
I cannot believe you even have a control name called that? :(
I have a column in a table with the name value_source where all the URLs are kept so the control is called value_source in the form
 

Gasman

Enthusiastic Amateur
Local time
Today, 10:02
Joined
Sep 21, 2011
Messages
14,319
So what is the value of value_source? I would use Me.Value_Source.
Put a debug.print Me.Value_Source before you try and use the control, comment out the hyperlnk line for now.
 

cayham86

Member
Local time
Today, 10:02
Joined
Jun 30, 2022
Messages
54
So what is the value of value_source? I would use Me.Value_Source.
Put a debug.print Me.Value_Source before you try and use the control, comment out the hyperlnk line for now.
Value in value source is any website URL and I will try me.Value_Source and let u know how I get on.

Also what does debug.print Me.Value_Source do as just tried it but couldn't tell if anything happened?
 

Gasman

Enthusiastic Amateur
Local time
Today, 10:02
Joined
Sep 21, 2011
Messages
14,319
The Me ensures you get the form control value.
The debug.print goes to the Immediate Window (Ctrl + G) and you should see the output. You can also get there via the View menu option, in the VBA IDE
Then you can copy that output and paste back here.
 

cayham86

Member
Local time
Today, 10:02
Joined
Jun 30, 2022
Messages
54
1656853701142.png
Problem in yellow I think
 

cayham86

Member
Local time
Today, 10:02
Joined
Jun 30, 2022
Messages
54
The Me ensures you get the form control value.
The debug.print goes to the Immediate Window (Ctrl + G) and you should see the output. You can also get there via the View menu option, in the VBA IDE
Then you can copy that output and paste back here.
Can we DM as a lot easier
 

moke123

AWF VIP
Local time
Today, 05:02
Joined
Jan 11, 2013
Messages
3,921
In order to use any procedure to open a url you need to insure you have a valid url.
If you'll note in Gasmans signature Debug.Print is your lifesaver.

put a button on your form and in the onclick event put


Code:
debug.print   "VS  = " & me.Value_Source

Then copy the result from the immediate window and paste it here.
 

Gasman

Enthusiastic Amateur
Local time
Today, 10:02
Joined
Sep 21, 2011
Messages
14,319
Can we DM as a lot easier
No, as that does not help anyone else.
So change that to
Dim strUrl As String
strUrl = "http://" & Me.value_Source
Debug.Print "url = " & strUrl
'Application.FollowHyperlink strUrl

Notice I commented out the FollowHyperlink for now.

Go to the immediate window and copy and paste the output back here
 

Gasman

Enthusiastic Amateur
Local time
Today, 10:02
Joined
Sep 21, 2011
Messages
14,319
Right, get rid of the # characters
Before you do that though, get rid of the https:// that the code is putting before the control value and try as is, as you already have that in the url, after removing the Rem. a single quote is enough to comment out a line, less typing. :)

I am pretty sure BBC does not need a https: as well?

You are not understanding any of this. :(
You were trying to use "http://#https://www.bbc.co.uk/news#" which is just rubbish. :(

Failing that, just upload the DB. We are over 30 replies here for just a simple task, and hardly getting anywhere. :(

Testing in the immediate window shows it does not like that format?

1656855090068.png
 

Attachments

  • 1656855034464.png
    1656855034464.png
    21.8 KB · Views: 60

moke123

AWF VIP
Local time
Today, 05:02
Joined
Jan 11, 2013
Messages
3,921
Those are not valid urls. That appears to be the display text part of a hyperlink datatype.

I think we now know the issue.

Many experienced developers dont use hyperlink datatype. Its a P.I.T.A. in my opinion. I store the url as text.
 

Gasman

Enthusiastic Amateur
Local time
Today, 10:02
Joined
Sep 21, 2011
Messages
14,319
A quick test in the IW, works

Code:
strUrl = "#https://www.bbc.co.uk#"
strUrl = Replace(strUrl,"#","")
debug.Print strUrl
https://www.bbc.co.uk
application.FollowHyperlink strurl
 

cayham86

Member
Local time
Today, 10:02
Joined
Jun 30, 2022
Messages
54
1656855467957.png


Still getting a hash at the start and end of website URLS so they wont open when clicked how do I solve that.
 

Attachments

  • 1656855470789.png
    1656855470789.png
    12.5 KB · Views: 67

Gasman

Enthusiastic Amateur
Local time
Today, 10:02
Joined
Sep 21, 2011
Messages
14,319
I have just shown you the code to get rid of them?
 

moke123

AWF VIP
Local time
Today, 05:02
Joined
Jan 11, 2013
Messages
3,921
The problem is your using hyperlink datatype. Hyperlink datatype is a composite datatype that access does things to behind the scenes. the are several parts to this datatype. There is the display part which is surrounded with octothorpes(#). There is also the actual address and subaddresses and tooltext.

my advice is to store your URLs as text datatype. Then all the methods you have been shown will work.

The alternative is to use application.HyperlinkPart to extract the url portion.

*** to be perfectly honest I'm not sure if I have the syntax parts of the above correct because I NEVER use Hyperlink Datatype for just this reason.
 
Last edited:

cayham86

Member
Local time
Today, 10:02
Joined
Jun 30, 2022
Messages
54
Code:
Option Explicit
Private Sub Command56_Click()
Dim strUrl As String
strUrl = Me.Value_Source
strUrl = Replace(strUrl, "#", "")
Application.FollowHyperlink strUrl
End Sub

This code has finally got it opening in chrome, if I set my default browser to Firefox will it automatically open in Firefox
 

Users who are viewing this thread

Top Bottom