Hello Dave
In your class module, try this
Event MyRSAsyncFetchComplete()
Event MyRSAsyncFetchProgressComplete(ByVal Progress As Long, MaxProgress As
Long)
Public WithEvents MyRS as Recordset
Public Sub GetRecords()
On Error GoTo ShowError
If MyRS Is Nothing Then
Set MyRS = New Recordset
With MyRS
'HERE YOU SET RECORDSET'S PROPERTIES LIKE_
CacheSize, CursorLocation, CursorType & LockType
End with
Else
MyRS.Close
End If
'HERE YOU SET THE CONNECTION MyCon
MyRS.Open MyCon, , , , adAsyncExecute OR adAysncFetch
Exit Sub
ShowError:
''ERROR CODE HERE
End Sub
Private Sub MyRSAsync_FetchComplete(ByVal pError As ADODB.Error, _
adStatus As ADODB.EventStatusEnum, _
ByVal pRecordset As ADODB.Recordset)
RaiseEvent MyRSAsyncFetchComplete
End Sub
Private Sub MyRAsync_FetchProgress(ByVal pError As ADODB.Error, _
adStatus As ADODB.EventStatusEnum, _
ByVal pRecordset As ADODB.Recordset)
RaiseEvent MyRSAsyncFetchProgress(Progress,MaxProgress)
End Sub
HTH
Happy Computing
Sukesh
Quote:
> Hi
> I'm using a generic data transfer form to manage the downloading of
> recordsets from a SQL Server db sitting on a web host. The form is
> managed from a class module which manages all recordset processes.
> For small downloads (< 100 records) adAsyncFetch is not used. For larger
> recordsets adAsyncFetch is used to give visual feedback using a counter
> and progressbar. The process works great until the end of
> MyRs_FetchComplete when VB6 crashes:
> Err message: This program has performed an illegal operation and will be
> shut down. VB6 caused an invalid page fault at Module MSADO15.DLL at
> 0137:1f49029c etc - and VB closes down.
> Any advice or ideas are welcome as I'm stuck.
> Ta
> Dave
> Private Sub MyRs_FetchComplete(ByVal pError As ADODB.Error, _
> adStatus As ADODB.EventStatusEnum, _
> ByVal pRecordset As ADODB.Recordset)
> If bStopped = False Then
> Set cAdo.Recordset = MyRs
> cAdo.RecordsetIsOpen = True
> cAdo.TidyUp
> ElseIf bStopped = True Then
> Set cAdo.Recordset = Nothing
> bStopped = False
> End If
> <-----error occurs here and vb crashes
> End Sub
> in the class module
> Public Sub TidyUp()
> On Error GoTo vbError
> If Not frmDataTransfer.cAdo.Recordset Is Nothing Then
> If frmDataTransfer.cAdo.Recordset.RecordCount > 0 Then
> Set Recordset = frmDataTransfer.cAdo.Recordset
> RecordsetIsOpen = True
> If Not GradientPicture Is Nothing Then UpdateGradient
> End If
> End If
> Unload frmDataTransfer
> Exit Sub
> vbError:
> eError
> End Sub