dcsimg


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: Find Method with Multiple Criteria

  1. #1
    Karl Robinson Guest

    Find Method with Multiple Criteria


    Hi,

    I try to use the FIND method of an ADO recordset object with this criteria,
    Field_1='abc' AND Field_2='xyz'
    It returns an error 3001.
    In fact, on the form, users browse thousands of records from a MSFlexGrid
    and they can input values for different fields everytime to find the record
    they want. Thus, the criteria can be a combination of any fields of the
    recordset. If record found, highlight the record in the MSFlexGrid.

    Can anyone give me some hits for doing this ?

    Thanks a lot.
    Karl

  2. #2
    Sergey Kats Guest

    Re: Find Method with Multiple Criteria

    Find() doesn't allow multiple columns search.
    You might be able to use Filter property that allow multi column criteria
    rs.Filter = "Field_1='abc' AND Field_2='xyz'"
    and to reset the filter use rs.Filter = ""

    - Sergey

    "Karl Robinson" <kklo@hehe.com> wrote in message
    news:3b58e5d5$1@news.devx.com...
    >
    > Hi,
    >
    > I try to use the FIND method of an ADO recordset object with this

    criteria,
    > Field_1='abc' AND Field_2='xyz'
    > It returns an error 3001.
    > In fact, on the form, users browse thousands of records from a MSFlexGrid
    > and they can input values for different fields everytime to find the

    record
    > they want. Thus, the criteria can be a combination of any fields of the
    > recordset. If record found, highlight the record in the MSFlexGrid.
    >
    > Can anyone give me some hits for doing this ?
    >
    > Thanks a lot.
    > Karl




  3. #3
    Ron Phillips Guest

    Re: Find Method with Multiple Criteria


    I remembered this same question from vb.database.general:

    On Sun, 22 Jul 2001 18:59:00 GMT, rphillips71@hotmail.com.NOSPAM (Ron
    Phillips) wrote:

    >
    >You might try using the Clone() method instead to see if you have
    >matches. You could use something like:
    >
    > Dim rsFilter As ADODB.Recordset
    > rs.Filter = "Field_1 = 'abc' and Field_2 = 'xyz'"
    > Set rsFilter = rs.Clone
    > If Not (rsFilter.BOF And rsFilter.EOF) Then
    > 'Records found
    > End If
    >
    >The clone method basically filters the original by some criteria. I
    >don't know about the speed implications, but I'm assuming this is
    >going to be faster than executing another query.
    >
    >Ron
    >


    On 20 Jul 2001 19:15:49 -0700, "Karl Robinson" <kklo@hehe.com> wrote:

    >
    >Hi,
    >
    >I try to use the FIND method of an ADO recordset object with this criteria,
    >Field_1='abc' AND Field_2='xyz'
    >It returns an error 3001.
    >In fact, on the form, users browse thousands of records from a MSFlexGrid
    >and they can input values for different fields everytime to find the record
    >they want. Thus, the criteria can be a combination of any fields of the
    >recordset. If record found, highlight the record in the MSFlexGrid.
    >
    >Can anyone give me some hits for doing this ?
    >
    >Thanks a lot.
    >Karl



  4. #4
    andrew oneill Guest

    Re: Find Method with Multiple Criteria


    "Karl Robinson" <kklo@hehe.com> wrote:
    >
    >Hi,
    >
    >I try to use the FIND method of an ADO recordset object with this criteria,
    >Field_1='abc' AND Field_2='xyz'
    >It returns an error 3001.
    >In fact, on the form, users browse thousands of records from a MSFlexGrid


    The other answers to your question are good... But...

    I wonder if you could not arrange the initial read so's it gives some sort
    of default filter in a where clause and so reduce the initial read.
    Quite often a user will virtually always be dealing with records to do with
    their particular team, sales area or at a manufacturing stage (etc).
    You can stick the criteria a particular user last used in their registry
    and re-apply as they load the form.

    Just a thought.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center