Results 1 to 6 of 6
  1. #1
    Join Date
    Aug 2003
    Posts
    3

    Question Unanswered: How do I use FetchComplete

    I need to use the FetchComplete event on an ADODB recordset but even though I have tried all sorts of things found on the internet I cant get it to work.

    Is this because it's not available in Access 2000 or is ADODB not asyschronous by default?

    Here is the test code I have used.

    Code:
    Dim WithEvents rs As ADODB.Recordset
    
    Private Sub Command0_Click()
    
        Set rs = New ADODB.Recordset
        
        rs.Open "SELECT * FROM tblData", CurrentProject.Connection
    
    End Sub
    
    Private Sub rs_FetchComplete(ByVal pError As ADODB.Error, _
       adStatus As ADODB.EventStatusEnum, _
       ByVal pRecordset As ADODB.Recordset)
    
        MsgBox "hello"
    
    End Sub
    At least that's close to what I was using.

    Any ideas??

  2. #2
    Join Date
    Aug 2003
    Location
    Delft, The Netherlands (EU)
    Posts
    447

    Re: How do I use FetchComplete

    Originally posted by FrancisHoey
    I need to use the FetchComplete event on an ADODB recordset but even though I have tried all sorts of things found on the internet I cant get it to work.

    Is this because it's not available in Access 2000 or is ADODB not asyschronous by default?

    Here is the test code I have used.

    Code:
    Dim WithEvents rs As ADODB.Recordset
    
    Private Sub Command0_Click()
    
        Set rs = New ADODB.Recordset
        
        rs.Open "SELECT * FROM tblData", CurrentProject.Connection
    
    End Sub
    
    Private Sub rs_FetchComplete(ByVal pError As ADODB.Error, _
       adStatus As ADODB.EventStatusEnum, _
       ByVal pRecordset As ADODB.Recordset)
    
        MsgBox "hello"
    
    End Sub
    At least that's close to what I was using.

    Any ideas??
    Try to open your RS asynchronously
    Make everything as simple as possible, but not simpler! - A. Einstein
    DB Problems? DB Explorer, BTrieve Re-engineering, DB Conversions & ETL? Conversion Tool

  3. #3
    Join Date
    Aug 2003
    Posts
    3

    Question

    I've tried
    Code:
    rs.Open "SELECT * FROM tblData", CurrentProject.Connection, , , adAsyncExecute
    and

    Code:
    rs.Open "SELECT * FROM tblData", CurrentProject.Connection, , , adAsyncFetch
    I also tried setting the cacheSize to 1 but still having no luck.
    Last edited by FrancisHoey; 08-14-03 at 07:20.

  4. #4
    Join Date
    Aug 2003
    Location
    Delft, The Netherlands (EU)
    Posts
    447
    Originally posted by FrancisHoey
    I've tried
    Code:
    rs.Open "SELECT * FROM tblData", CurrentProject.Connection, , , adAsyncExecute
    and

    Code:
    rs.Open "SELECT * FROM tblData", CurrentProject.Connection, , , adAsyncFetch
    I also tried setting the cacheSize to 1 but still having no luck.
    Default is Server-Side cursors, try asynchroun with client-side cursorlocation
    Make everything as simple as possible, but not simpler! - A. Einstein
    DB Problems? DB Explorer, BTrieve Re-engineering, DB Conversions & ETL? Conversion Tool

  5. #5
    Join Date
    Aug 2003
    Posts
    3

    Cool

    YES!!!

    Thats done it!

    Final code was

    Code:
    Dim WithEvents rs As ADODB.Recordset
    
    Private Sub Command0_Click()
    
        Set rs = New ADODB.Recordset
        rs.CacheSize = 1
        rs.CursorLocation = adUseClient
        rs.Open "SELECT * FROM tblData", CurrentProject.Connection, , , adAsyncFetch
        
        Do
            DoEvents
        Loop Until rs.State = 1
        
        Me.List3.RowSource = rs.GetString(, , ";", ";", "")
    
    End Sub
    
    Private Sub rs_FetchComplete(ByVal pError As ADODB.Error, _
       adStatus As ADODB.EventStatusEnum, _
       ByVal pRecordset As ADODB.Recordset)
    
        MsgBox "hello"
    
    End Sub
    Thanks for all your help!

  6. #6
    Join Date
    Aug 2003
    Location
    Delft, The Netherlands (EU)
    Posts
    447

    Cool Solved

    You are welcome
    Make everything as simple as possible, but not simpler! - A. Einstein
    DB Problems? DB Explorer, BTrieve Re-engineering, DB Conversions & ETL? Conversion Tool

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •