rs.findnext problem

Lisad

Access Beginner
Local time
Yesterday, 22:06
Joined
Jan 26, 2005
Messages
31
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>
 
There's different ways to loop through a recordest.

Code:
Do Until rs.EOF
    <code here>
    rs.MoveNext    'rs.FindNext
Loop
 
rs.findnext

What code do I insert under the Do Until rs.EOF? Sorry but I do not know much about VBScript at all. Where abouts do I put it in the code I already have?
 

Users who are viewing this thread

Back
Top Bottom