Results 1 to 12 of 12

Thread: Adding a progress bar while the flexgrid is populating

Hybrid View

  1. #1
    VB Addict Pradeep1210's Avatar
    Join Date
    Apr 2004
    Location
    Inside the CPU...
    Posts
    6,614

    Re: Adding a progress bar while the flexgrid is populating

    Are u using a server side cursor?? The code above will work only for client side cursors. For serverside cursors, the values of recordcount and absoluteposition are returned wrong.

    Secondly, ain't these two statements the same (dglienna)?
    ProgressBar1.Value = int(rsmain.AbsolutePosition * 100 / rsmain.RecordCount)

    ProgressBar1.Value = int(rsmain.AbsolutePosition / rsmain.RecordCount) * 100

  2. #2

    Thread Starter
    Member
    Join Date
    Nov 2001
    Posts
    43

    Question Re: Adding a progress bar while the flexgrid is populating

    How would I tell whether or not I'm using a server side cursor?

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

    Re: Adding a progress bar while the flexgrid is populating

    They were reversed.

    ProgressBar1.Value = int(rsmain.RecordCount * 100 / rsmain.AbsolutePosition )

  4. #4
    VB Addict Pradeep1210's Avatar
    Join Date
    Apr 2004
    Location
    Inside the CPU...
    Posts
    6,614

    Re: Adding a progress bar while the flexgrid is populating

    In the debug window check "?rs.CursorLocation= adUseClient" is true or "?rs.CursorLocation= adUseServer" is true. Many a times if you set the cursor location from code but is not supported by the provider, they are reset by the provider.
    In case it is a server side cursor, don't use absoluteposition property. Instead keep a counter in the loop and use that.
    Sample Code:
    VB Code:
    1. Dim nCurrRec as long
    2. ProgressBar1.Min = 0
    3. ProgressBar1.Max = 100
    4.  
    5. 'Your Code
    6. '
    7. '
    8. nCurrRec = 0
    9. Do While Not rsmain.EOF()
    10.     'Your Code
    11.     '
    12.     '
    13.     nCurrRec =nCurrRec +1
    14.     ProgressBar1.Value = int(nCurrRec  * 100 / rsmain.RecordCount)
    15. Loop
    Edit: This code would work, whichever cursor you are working

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