Results 1 to 5 of 5

Thread: Recordset Counting on Current Record

  1. #1

    Thread Starter
    Fanatic Member mateo107's Avatar
    Join Date
    Jan 2005
    Posts
    547

    Recordset Counting on Current Record

    Hi Everyone,

    I have my recordset declared as rs. I'm trying to run a progress bar which will show how many records the search has gone through. I don't have VB6 on this machine, so I was wondering if someone could just check my logic/syntax.

    So to accomplish this I will do the following:

    Open the Recordset
    VB Code:
    1. Dim iCsrNum as Integer 'to hold the total number of customers
    2. iCsrNum = rs.RecordsetCount
    3. ProgressBar1.Max = iCsrNum
    4. ProgressBar1.Value = 1

    My question is, is there any built-in way to find the current record number, as opposed to creating a counter for each record? For example is there any easy way like?

    VB Code:
    1. Do Until rs.EOF
    2. ProgressBar1.Value = rs.CurrentRecordNum
    3. Loop

    As opposed to this?
    VB Code:
    1. Dim iCurrentRecCount as Integer
    2. iCurrentRecCount = 0
    3. Do Until rs.EOF
    4. iCurrentRecCount = iCurrentRecCount + 1
    5. ProgressBar1.Value = iCurrentRecCount
    6. Loop

    Does my question make sense?


    -Matthew-

  2. #2
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: Recordset Counting on Current Record

    Try the AbsolutePosition property.....
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  3. #3

    Thread Starter
    Fanatic Member mateo107's Avatar
    Join Date
    Jan 2005
    Posts
    547

    Re: Recordset Counting on Current Record

    So that'd be
    VB Code:
    1. rs.AbsolutePosition
    ?


    -Matthew-

  4. #4
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: Recordset Counting on Current Record

    VB Code:
    1. Do Until rs.EOF
    2.     ProgressBar1.Value = rs.AbsolutePosition + 1
    3. Loop
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  5. #5
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Recordset Counting on Current Record

    This is the coolest way to do it.

    http://www.vbforums.com/showthread.p...ht=progressbar

    Use the Fetch event of your query.

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