Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

retrieving records progress

Status
Not open for further replies.

ultimatewilliam

Programmer
Oct 16, 2002
57
SG
hi, i'm actually populating a data control with certain records from a table by this code:

With adodc1
.RecordSource = "Select * from MyTable"
.Refresh
End With


when the process is too long, i have to display a progress bar so the user would know that the retreival is being done, at the same time the user may cancel the operation if he wants to. hope you could help me with this. thanks!
 

I believe (could be wrong) that you will need to make your query asynchronous and check the still executing property. While you are in that loop you could increment your progress bar (either with value if returned or just to show user something).

Good Luck

 

Or, use the FetchProgress event of an ADO recordset object...

[/b][/i][/u]*******************************************************
General remarks:
If this post contains any suggestions for the use or distribution of code, components or files of any sort, it is still your responsibility to assure that you have the proper license and distribution rights to do so!
 
can i use FetchProgress with the ado data control? do you any idea on how to use it? thanks.
 
Nope.

You could, however, create a recordset object declare using
WithEvents and then assign the recordset object to the Data control's recordset:

Option explicit
Private WithEvents rsADO As ADODB.Recordset
Private conn As ADODB.Connection

Private SomeProceedure()

'Code to open connection and recordset object

Set conn = ADODB.Connection
Set = New ADODB.Recordset

conn.Open 'Connection string here

Set rsADO = Adodc1.Recordset
With rsADO
Set .ActiveConnection = conn
.CursorLocation = adUseClient
.CursorType = adOpenStatic
.LockType = adLockOptimistic
.Source = "SELECT * FROM SomeTable"

.Open Options:=adCmdText Or adAsyncFetch

End With

Set Adodc1.Recordset = rsADO

End Sub

Private Sub rsADO_FetchProgress(ByVal Progress As Long, ByVal MaxProgress As Long, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)

'code for progressbar

End Sub


But, if you go that far, you do not need to use the Adodc1.
For bound controls just set their data source to the rsADO recordset object.
Then you can change all references to the Adodc1.Recordset to the rsADO recordset object, and then remove the Adodc.
[/b][/i][/u]*******************************************************
General remarks:
If this post contains any suggestions for the use or distribution of code, components or files of any sort, it is still your responsibility to assure that you have the proper license and distribution rights to do so!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top