Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Combine User Text Box data to my Hyperlink?

Status
Not open for further replies.

gbs01

MIS
Jun 2, 2003
73
US
I have the following hyperlink string:
--------------------------------------
IF+I+COULD+HEAR
&selQuickSearch=SongTitle
--------------------------------------

I want the user to be able to type a Partial song title in my txtSong box on my Form, and have the onclick event run this code:

--------------------------------------
Dim strPrefix As String, strSuffix As String, strSong As String
strPrefix = "strSong = Nz(Me!txtSong, " ")
strSuffix = "&selQuickSearch=SongTitle"
Application.FollowHyperlink strPrefix & strSong & strSuffix, , True
End Sub
--------------------------------------
My problem is the strSong part, For example, if user types "If I Could Hear" in my txtSong box, the code must convert that to IF+I+COULD+HEAR in order for it to be accepted in my hyperlink.

Thanks in advance for your help!
jlig
 
strSong = UCase(Replace(strSong, " ", "+"))

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thanks for your Help! I am just beginning to learn the VB side of Access and have relied on this forum alot!

Anyway, it now gives me this:
------------------------------
------------------------------
instead of this which is correct:
-------------------------------
--------------------------------
Looks like it left out my txtSong altogether.
Thanks again!
jlig
 
Really ? My suggestion was this:
strPrefix = "strSong = Nz(Me!txtSong, " ")
[highlight]strSong = UCase(Replace(strSong, " ", "+"))[/highlight]
strSuffix = "&selQuickSearch=SongTitle"
Application.FollowHyperlink strPrefix & strSong & strSuffix, , True

A shorter way:
strPrefix = "strSong = UCase(Replace(Me!txtSong & "", " ", "+"))
strSuffix = "&selQuickSearch=SongTitle"
Application.FollowHyperlink strPrefix & strSong & strSuffix, , True

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thanks again! Sorry for my mis-understanding.

When I go to IE6 browser and type in :
--------------------------------------
--------------------------------------
I get the correct page.

The other 2 solutions seem to leave out the IF+I+COULD+HEAR.
thanks! jlig
 
What is displayed if you add this line of code just before the FollowHyperlink call ?
MsgBox "'" & strPrefix & strSong & strSuffix & "'"

BTW, try this:
strAddress = "strExtra = "mode=search&txtTitle=" & UCase(Replace(Me!txtSong & "", " ", "+")) & "&selQuickSearch=SongTitle"
Application.FollowHyperlink strAddress, , True, , strExtra

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
The messagebox shows :
--------------------------------------
Code:
[URL unfurl="true"]http://shop1.gospeland.com/e/advSearch.asp?mode=search&txtTitle=&selQuickSearch=SongTitle[/URL]
--------------------------------------

note: In the first post :
Code:
mode=search&txtTitle=

should have been
Code:
mode=search&txtTitle=

Thanks 4x
jlig
 
Seems Me!txtSong is empty ...

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Maybe thats it! What I have is a Text Box Above my GO button. I type the text into the empty box, and click the GO button which has the code with the hyperlink. The name of the Text box in properties is txtSong . Is this correct? Maybe my code is not pulling in the text like you said? Everything else works great! The web page opens & the link is entered, but it's missing the txtSong string.

jlig
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top