Results 1 to 5 of 5

Thread: Distinct value...pls help

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 2002
    Posts
    69

    Question Distinct value...pls help

    Hi

    How can I retrieve the next value from distinct using the code below?

    *********************************************************
    Qry = "Select distinct size from parttb Where id = '" & txtItem.List(i) & "' "
    Set RawSql = New ADODB.Recordset
    RawSql.CursorLocation = adUseClient
    RawSql.Open Qry, S_GateDb, adOpenDynamic, adLockPessimistic

    Size1 = RawSql(0)
    //How to get size2 and so on
    *********************************************************
    Kindly enlightened me. Thanks alot

  2. #2
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Distinct value...pls help

    You need to navigate through the recordset by calling MoveNext (Previous, First, Last) method(s):
    Code:
    RawSql.MoveNext
    If RawSql.EOF THen RawSql.MoveLast

  3. #3
    Lively Member Bolerophone's Avatar
    Join Date
    Dec 2003
    Location
    Himalayas
    Posts
    123

    Re: Distinct value...pls help

    Use this


    VB Code:
    1. while Rset.EOF = False
    2.  
    3.     ....
    4.    
    5.     RSET.MoveNext
    6.  
    7. wend
    Jobs: "Do u want to sell colored sugar water or change the world?"

    Get Firefox Now!!!
    Mendhak leaving town.

  4. #4
    Hyperactive Member
    Join Date
    Mar 2002
    Location
    Pakistan
    Posts
    436

    Post Re: Distinct value...pls help

    Try This

    First of all count total records in recordset

    then declare an arry subject to totalrecords

    start do while loop till eof

    move size from table to array


    do while Rset.Eof = False
    size[1] = Rset!size
    Rset.MoveNext
    Loop

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Sep 2002
    Posts
    69

    Resolved: Distinct value...pls help

    Thanks a lot...

    I solved it using Do Loop.. then RawSql.MoveNext

Posting Permissions

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



Click Here to Expand Forum to Full Width