I have the following VBScript which finds a record based on text input into a message box. What I would like is a 'Find Next' to search through all the records that meet the criteria. How do I do this? Do I need another command button?
<SCRIPT language=vbscript event=onclick for=cmdSearch>
<!--
Dim rs
Set rs = MSODSC.DataPages(0).Recordset.Clone
On error resume next
rs.find "CompanyName like '*" & CStr(InputBox("Please enter a prospect to find", "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 Company found",,"Search Done"
Exit Sub
End If
MSODSC.DataPages(0).Recordset.Bookmark = rs.Bookmark
-->
</SCRIPT>
<SCRIPT language=vbscript event=onclick for=cmdSearch>
<!--
Dim rs
Set rs = MSODSC.DataPages(0).Recordset.Clone
On error resume next
rs.find "CompanyName like '*" & CStr(InputBox("Please enter a prospect to find", "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 Company found",,"Search Done"
Exit Sub
End If
MSODSC.DataPages(0).Recordset.Bookmark = rs.Bookmark
-->
</SCRIPT>