Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old May 25th, 2005, 8:07 AM   #1
mhuckaba
Newbie
 
Join Date: May 2005
Posts: 8
Rep Power: 0 mhuckaba is on a distinguished road
*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 10:58 AM.
mhuckaba is offline   Reply With Quote
Old May 25th, 2005, 10:46 AM   #2
mhuckaba
Newbie
 
Join Date: May 2005
Posts: 8
Rep Power: 0 mhuckaba is on a distinguished road
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 11:00 AM.
mhuckaba is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 12:09 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC