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!

Adding a Search Button Image to my Form ?

Status
Not open for further replies.

gbs01

MIS
Jun 2, 2003
73
US
I have a Hyper-Link txtSong field in my Access Form that allows me to :
1) Type in a song title,
2) Then when clicked, it opens up my website
3) And displays the web search results for the
txtSong entry
I want to change this to a Search Button image, placed right below the txtSong box. ?

Heres my current code :
--------------------------
Private Sub txtSong_Click()
Dim strPrefix As String, strSuffix As String, strSong As String
strPrefix = "strSong = Me!txtSong
strSuffix = "&selQuickSearch=SongTitle&Submit1=Search"
Application.FollowHyperlink strPrefix & strSong & strSuffix, , True
End Sub
--------------------------

How do I make this work by clicking on a GO button instead of the hyperlink text?

On my form I have added the GO button image below my text box, but I don't know how to make the Go button the hyperlink, so that when I click on it, it performs the same function as my old text field.

Ex: enter song title : _______________

GO
 
hi,

goto the properties of your "GO" button. On the format tab, there is a field called: "Hyperlink Address". Insert your hyperlink information there and Viola! Go button is now a hyperlink.

HTH



Have A Great Day!!!, [bigglasses]

Nathan
Senior Test Lead
 
Thanks for the Reply!

It now works great! But....It only works one time.

The next time it gives the error message:
--------------------------------------
Runtime error 94 : Invalid use of NULL
--------------------------------------

So heres what I did:
1)I added a Refresh command to clear the old entry, which blanks out the txtSong field.
2)I then typed in a new song, and clicked on GO.

I get that error 94 Null problem.

If I completely close my form & reopen, it works first time again.

I know this is a refresh issue, but not sure what to do?
Thanks again!
Jerry
 
Hold On, Heres the full picture of what it's doing:

1) When I open the Form the first time, it gives me the null error message.

2) I click on debug, & it takes me to the yellow:
strSong = Me!txtSong

3) If I click SAVE in Visual Basic, and EXIT, then the search form works right.
4) If I search a second time, It works each time, but gives me the first results each time.

Question : Why is it remembering what I typed in that txtSong box the first time? Is it storing it somewhere?
 
hi gbs01,

I dont see any reason for it to store the variable assuming you changed what was in the textbox. the code you have shown will pull from that box every time.

i took your code and created a form with a button. the variable changes every time i use it. now, the problem i have is when it gets to the webpage. it doesnt actually perform the search but brings me to the search page. the variable i entered does appear on the browser address bar, so i know its picking the variable up correctly. it appears to be another problem in the asp part but ... i do not anything about asp. :-(

here is what i used:

Private Sub Command0_Click()

Dim strPrefix As String, strSuffix As String, strSong As String
strPrefix = "strSong = Me!txtSong
strSuffix = "&selQuickSearch=SongTitle&Submit1=Search"
Application.FollowHyperlink strPrefix & strSong & strSuffix, , True


End Sub


sorry i couldnt help more.

Have A Great Day!!!, [bigglasses]

Nathan
Senior Test Lead
 
Thanks Nathan!
The reason it didnt do the search for you is that the strPrefix end should have been :

mode=search&txtTitle=

(The post must have changed my line? when I sent it?.)

but...

Try it again, after updating the strPrefix & enter jesus as keyword. Then you'll get error 94 : invalid use of null. Click debug, and then the save option in VB, Exit VB and click save your search form . Now the search will work. But if you enter a new word, like asleep, it will open up the browser window & find jesus.

Thanks! for your help.
Jerry


It will work each time, but no matter what word I enter into txtSong, I get the same search results? It's like it saves the first entry & uses it every time.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top