Distinct Values in the RecordSet

Posted on 2004-10-21
Last Modified: 2013-11-26
hi experts,
  I have the recordset.  How do i get the distinct values in recordset.  Please note that I cannot modify the source.  Please let me know how this can be done.  I have to used find and filter property but could achive the desired result

Question by:ajexpert
    LVL 69

    Expert Comment

    by:Éric Moreau
    You will need to sort the recordset and loop through each row to detect when the value change. There is nothing else you can do on an already opened recordset
    LVL 26

    Expert Comment

    LVL 1

    Expert Comment

    Dear when you are creating the recordset i think you have to enter the query for distinct recordset

    any you will get the records in disinct way

    LVL 14

    Expert Comment

    by:Shiju Sasidharan
    i think bangerarun is right
    u can change ur SQL Query like this

    SELECT DISTINCT *  FROM Your_Table_Name

    this will return only distinct rows from the table Your_Table_Name


    LVL 14

    Author Comment

    bangerarun, shijusn
     My query clearly says I cannot modify the source i.e. I cannot modify the query.  I have to play with recordset only to get distinct values
    LVL 14

    Accepted Solution

    hi ajexpert
    ok , u need to findout distint values in a particular filed or need to findout distinct rows in the recordset ?
    to extract distict values from a selected filed
    it is better to add entry from the record set to a ListView and use the method
    ListView1.FindItem to check whether u have already entered this entry  , if so skip and try with the next record in the field

    This is not a direct method to solve ur problem . anyway it will work to filter record set


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
    Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
    Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
    Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

    913 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now