Data1.Recordset.Filter ????????-VBForums
Results 1 to 9 of 9

Thread: Data1.Recordset.Filter ????????

  1. #1

    Thread Starter
    Fanatic Member coox's Avatar
    Join Date
    Oct 1999
    Posts
    527

    Unhappy

    Can anyone tell me what this is for? And how to use it? There seems to be no specific help for this on the MSDN cds...
    Nick Cook
    VB6 (SP6)

  2. #2
    Addicted Member jeroenh's Avatar
    Join Date
    Aug 2000
    Location
    Rotterdam, Holland
    Posts
    201
    I don't know if you have ever worked with MS Access but if so you should be ashamed.

    This filter option you are talking about is an extra SQL-command that is used to limit the number of record listed. In order to do this fast and to remove it fast, microsoft gave us this command.

    You can use it with a recordset, but also with a database. When you do it with a database, then all recordsets based on this database-object has the same filter.

    When you change the database-filter, all the recordsets that are refreshed then take the new database filter. Enebling you to change a numoures count of recordsets with a single change.
    Catch you later,

    Jeroen Hoekemeijer
    Code:
    If 1 = 2 Then MajorError

  3. #3

    Thread Starter
    Fanatic Member coox's Avatar
    Join Date
    Oct 1999
    Posts
    527
    Woah Jeroen!!! I've worked a little with Access, but I feel no shame...

    Thing is, I do know what a filter is, and there is sample code in the MSDN, but only using created db objects, not ones drawn on a form. What I was really looking for was how to make this particular filter take effect.

    So can you give me some sample code please?
    Nick Cook
    VB6 (SP6)

  4. #4

    Thread Starter
    Fanatic Member coox's Avatar
    Join Date
    Oct 1999
    Posts
    527
    Don't nobody know?
    Nick Cook
    VB6 (SP6)

  5. #5
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    What is it you are trying to filter? Or what is it you want an example of? Be specific.
    We'll hook you up.

  6. #6

    Thread Starter
    Fanatic Member coox's Avatar
    Join Date
    Oct 1999
    Posts
    527
    I just want to know how to apply a filter for a data object. I've tried stuff like 'Data1.Recordset.Filter = ' and all that, but it doesn't seem to affect anything. Is there something I need to do to get the filter to take effect or what? The only filter example in the help system applies to data objects created at runtime.
    Nick Cook
    VB6 (SP6)

  7. #7

    Thread Starter
    Fanatic Member coox's Avatar
    Join Date
    Oct 1999
    Posts
    527
    Ed, I thought you were going to hook me up...
    Nick Cook
    VB6 (SP6)

  8. #8
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339

    A Thousand Apologise (I think I spelled that wrong) Effendi

    Lets say you have recordset with a FirstName field in the query and you want to limit it to just the first names that start with 'f' then
    Code:
    Data1.recordset.filter="FirstName Like f*"
    Lets take the same example and say you want to also take only those with the LastName starting with 'Ma'
    Code:
    Data1.recordset.filter="FirstName Like f* And LastName Like Ma*"
    Or if you want to filter by what a user has typed in a textbox
    Code:
    Data1.recordset.filter="Firstname='" & Text1.text & "'"
    And to reset the filter back to none
    Code:
    Data1.recordset.filter=""
    Sorry about the delay but better late then never

  9. #9

    Thread Starter
    Fanatic Member coox's Avatar
    Join Date
    Oct 1999
    Posts
    527
    Thanks mate, it was a long time coming!
    Nick Cook
    VB6 (SP6)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.