![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: May 2005
Posts: 8
Rep Power: 0
![]() |
*SOLVED* VBScript filter property !HELP!
I'm wondering if someone could educate me on how to use filters in scripting. I understand ApplyFilter's effect on fields, but I was wondering if there were any other filter functions in the form filter[field][value].
Last edited by mhuckaba; May 25th, 2005 at 11:58 AM. |
|
|
|
|
|
#2 |
|
Newbie
Join Date: May 2005
Posts: 8
Rep Power: 0
![]() |
Actually, I found another solution on the MSDN website:
<SCRIPT language=vbscript event=onclick for=search>
' 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.find "fieldname ='" & cStr(InputBox("Enter a ","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
MSODSC.Datapages(0).FirstSection.HTMLContainer.Children("make").Focus
MSODSC.Datapages(0).ApplyFilter
</SCRIPT>Basically, it searches a field, then goes to the first matching value in that field, and then filters the recordset based on what you searched for, so say for instance I searched field "make" for "HP" then it would go to the first entry of HP, then filter for HP, so I'd end up with all entries of HP. Last edited by mhuckaba; May 25th, 2005 at 12:00 PM. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|