rs.Filter ???....Please Help!

gmatriix

Registered User.
Local time
Today, 18:31
Joined
Mar 19, 2007
Messages
365
Hello All,

This is driving my crazy!

This is what Im trying to do: When the user puts in a Site number I wanted it to filter the records that are simular that number. Simular to what a query world do. (Like "*" & [Which Site #?] & "*")

So if I only input "LA25" it will pull all the records in the Site Number field that have "LA25" even if it says "LA25659"

the code I am using is:
rs.filter "[Site Number]= '"& InputBox("Enter Site Number") & "'"

:confused::confused::confused::confused:
Can anyone help????

Thanks
 
try
rs.filter "[Site Number] Like '*" & InputBox("Enter Site Number") & "*'"
 
Hey thanks...but I am getting an error:450 "Wrong number of arguments or invalid property assignment" Here is the whole script:

<SCRIPT language=vbscript event=onclick for=cmdFind>
<!--

' Clone the recordset.
Dim rs
Set rs = MSODSC.DataPages(0).Recordset.Clone



On error resume next
' This line assumes that the value you are filtering on is an integer.
' If the search value is a string, use slightly different syntax.
' For example, "CustomerID = '" & CStr(InputBox("Please enter customer to find", "Find")) & "'"
rs.filter "[Site Number] Like '*" & InputBox("Enter Site Number") & "*'"
' 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

Any Ideas?
 
Maybe try putting an = sign after rs.filter

So rs.filter = "[Site Number]...etc.
 
This worked with the = sign...however do I need a find next button because it looks like it just finds the first one.

This is what I used:
rs.filter ="[Site Number] Like *" & InputBox("Enter Site Number") & "*"
 
Oh...d'oh. Brain fart on my part. Thought Bob was talking about putting an = where the like was... :o

From the link I provided earlier:

When the Filter property is set, the cursor moves to the first record in the filtered Recordset.

So I think what you need is a move next record command button rather than find next.
 

Users who are viewing this thread

Back
Top Bottom