Create a Web Address on a Form for Followhyperlink

J

Jonas

I am trying to create a web address in Access. I have a form that
has
text boxes numbered 1-8. It is my intention to concatenate the text
in the text boxes to create an address then use the followhyperlink
method. I can create the string that I need but I get an error when
the code gets to the followhyperlink method; runtime error 490 cannot
open the specified file.

The reason why I intend to concatenate the text in the text boxes is
to allow the user flexibility. Some portions of the address are
going
to be static and others are going to depend on a value in a list box.
Here is an example. In JOffSec1 I have "http://finance.yahoo.com/q?
s=" and in JOffSec2 I have +[combo22]. I have a text box which
concatenates the contents of JOffSec1 and JOffSec2 this textbox is
called Text20. My code refers to Text20.


I am able to copy and paste the contents of Text20 into code and have
it work but I can't get the code to work when I refer to [Text20] in
the code even after setting [Text20] to some variable and using the
variable for the followhyperlink method.


Is it possible to copy and paste a line into code on the fly? Is
there another solution for my problem?
 
A

Anthos

This is the code I used, using your field names in Access 2007
Please advise if it is still not working for you.

'---==== On Click Event ====---
Dim strHyperLink As String
strHyperLink = Me.JoffSec1.Value & Me.Combo22.Value
Application.FollowHyperlink strHyperLink, , True, False

This had a text box with a value of "http://finance.yahoo.com/q?s=" in
it, called JOffSec1
There was a Combo box called combo22, that had a values of JBL and
OCFIX for testing.
There was a textbox called JOffSec2 that was =[JoffSec1] & [Combo22]
(note the no + symbol)

There was a button that I had that opened the web page, but that just
ran the code above.

Hope this helps with your MS Access Database.

Kind Regards
Anthony Moore

IT Excellence
 
J

Jonas

This is the code I used, using your field names in Access 2007
Please advise if it is still not working for you.

'---==== On Click Event ====---
Dim strHyperLink As String
strHyperLink = Me.JoffSec1.Value & Me.Combo22.Value
Application.FollowHyperlink strHyperLink, , True, False

This had a text box with a value of "http://finance.yahoo.com/q?s=" in
it, called JOffSec1
There was a Combo box called combo22, that had a values of JBL and
OCFIX for testing.
There was a textbox called JOffSec2 that was =[JoffSec1] & [Combo22]
(note the no + symbol)

There was a button that I had that opened the web page, but that just
ran the code above.

Hope this helps with your MS Access Database.

Kind Regards
Anthony Moore

IT Excellence

Anthony,

Thank you for responding to my question. However, it is my intention
to allow the user to determine where the stock ticker symbol will go
in the address. Another address might be something like this http://best
stock site=ticker symbol goes here quote. This is just something that
I made up. My text boxes would have the following data
JOffSec1="http://best stock site" JOffSec2=[combo22] (Combo22
contains the ticker symbol) JOffSec3="quote" I want to allow the user
to be able to set up the address.
 
J

Jonas

- Show quoted text -

Anthony,

I just used the replace function with the string variable that I
created to create a string that has the ticker symbol in it. I then
used the followhyperlink method.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top