|
-
May 5th, 2005, 12:46 AM
#1
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
-
May 5th, 2005, 06:02 PM
#2
Thread Starter
Member
Re: Adding a progress bar while the flexgrid is populating
How would I tell whether or not I'm using a server side cursor?
-
May 5th, 2005, 08:35 PM
#3
Re: Adding a progress bar while the flexgrid is populating
They were reversed.
ProgressBar1.Value = int(rsmain.RecordCount * 100 / rsmain.AbsolutePosition )
-
May 5th, 2005, 11:50 PM
#4
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:
Dim nCurrRec as long
ProgressBar1.Min = 0
ProgressBar1.Max = 100
'Your Code
'
'
nCurrRec = 0
Do While Not rsmain.EOF()
'Your Code
'
'
nCurrRec =nCurrRec +1
ProgressBar1.Value = int(nCurrRec * 100 / rsmain.RecordCount)
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|