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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search problem in data access page

Status
Not open for further replies.

camiller

IS-IT--Management
Jan 20, 2002
8
AU
Hi,

I'm new to data access pages and struggling with a Find button on my page. I want to allow the use to search a text field called Authors. I am not too good at VBScript, so this may be an obvious problem to those more seasoned. When I run the script below, I get a "error 13 type mismatch" error. Any thoughts from anyone. Any help is appreciated.

Code:
<SCRIPT language=vbscript event=onclick for=Find>
<!--
Dim rs
Set rs = MSODSC.DataPages(0).Recordset.Clone
On error resume next
rs.find "[Authors]=" & cLng(inputbox("Enter an author","Find"))
	If (err.number <> 0) then
	Msgbox "Error: " & err.number & " " & err.Description,,"Invalid Search"
	Exit Sub
	End If
	If (rs.bof) or (rs.eof) Then
	Msgbox "No author found",,"Search Done"
	Exit Sub
	End If
MSODSC.DataPages(0).Recordset.Bookmark = rs.Bookmark
-->
</SCRIPT>

C Miller
 
What is the data type of the Authors field ?
Your find instruction is designed for a numeric field.
You may try something like this if text field:
rs.find "[Authors] Like '%" & InputBox("Enter an author","Find") & "%'"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top