I really need some help trying to fiugure this out. I'm just starting to dive into the world of Access and this is the first VBA experience I have had. So here's the sccop.
I have an Access database. In column 1 are numbers, in column 2 are descriptions that contain multiple words.
I created an Access page and saved the HTML file. Users can now view the database via a web browser.
I then wanted to add a search button to that HTML page. I added the Command Button and then.....
From the Microsoft web site I built this into the code:
<SCRIPT language=vbscript event=onclick for=command0>
<!--
' Clone the recordset.
Dim rs
Set rs = MSODSC.DataPages(0).Recordset.Clone
On error resume next
-->
rs.find "Description = '" & cStr(inputbox("Enter a Key Word","Find")) &"'"
' Custom error handling.
If (err.number <> 0) Then
Msgbox "Error: " & err.number & " " & err.description,,"Invalid Search"
Exit Sub
End If
' Check search results for success.
If (rs.bof) or (rs.eof) Then
Msgbox "No Product found",,"Search Done"
Exit Sub
End If
MSODSC.DataPages(0).Recordset.Bookmark = rs.Bookmark
-->
</SCRIPT>
Now that all works fine, BUT, the description the user enters in has to match EXACTLY what's in the database for it to return any results. I want the user only to enter in a key word.
For example: In the database in the "Description" column there maybe be an entry "Great Oak Tree"
I would like the user to use the command button, enter in just "Oak" and get a result.
Seems easy enough, just need to put a * somewhere in the script......right?
Thanks
Jeff
I have an Access database. In column 1 are numbers, in column 2 are descriptions that contain multiple words.
I created an Access page and saved the HTML file. Users can now view the database via a web browser.
I then wanted to add a search button to that HTML page. I added the Command Button and then.....
From the Microsoft web site I built this into the code:
<SCRIPT language=vbscript event=onclick for=command0>
<!--
' Clone the recordset.
Dim rs
Set rs = MSODSC.DataPages(0).Recordset.Clone
On error resume next
-->
rs.find "Description = '" & cStr(inputbox("Enter a Key Word","Find")) &"'"
' Custom error handling.
If (err.number <> 0) Then
Msgbox "Error: " & err.number & " " & err.description,,"Invalid Search"
Exit Sub
End If
' Check search results for success.
If (rs.bof) or (rs.eof) Then
Msgbox "No Product found",,"Search Done"
Exit Sub
End If
MSODSC.DataPages(0).Recordset.Bookmark = rs.Bookmark
-->
</SCRIPT>
Now that all works fine, BUT, the description the user enters in has to match EXACTLY what's in the database for it to return any results. I want the user only to enter in a key word.
For example: In the database in the "Description" column there maybe be an entry "Great Oak Tree"
I would like the user to use the command button, enter in just "Oak" and get a result.
Seems easy enough, just need to put a * somewhere in the script......right?
Thanks
Jeff