Results 1 to 2 of 2

Thread: [RESOLVED] VB6/Access MoveNext error.

Threaded View

  1. #1

    Thread Starter
    Frenzied Member longwolf's Avatar
    Join Date
    Oct 2002
    Posts
    1,343

    Resolved [RESOLVED] VB6/Access MoveNext error.

    I'm still working on code to import updates from a specially designed/Exported mdb to the users main mdb.
    There are Do While loops that call subs to filter then display one record at a time.
    The loop then waits for the user to decide what they want to do with the record.

    rsIm is holds the imported records and stays open.
    The NextTable sub uses rsOrg to open records from the main mdb for testing against rsIm.

    The first record through the loop works fine.
    The user is able to Save it and the next record auto loads.
    But saving the 2nd record causes this error on the 'rsIm.MoveNext' line of the NextTable sub

    Name:  Error.jpg
Views: 664
Size:  23.2 KB

    By the time it gets to MoveNext, any changes to the records have already been made.
    At the point of the error, m_lItenCnt = 2 and rsIm.RecordCount = 11

    Any ideas of what I should look for?

    Code:
    'here's one of the loops from the Import Sub
                If OpenTbl(Tables) Then
                    m_eImporting = Tables
                    m_lItenCnt = 0
                    Do While m_lItenCnt < rsIm.RecordCount
                        NextTable
                        If m_lItenCnt < rsIm.RecordCount Then 'this is needed here as NextTable is recursive
                            WaitForAction
                        End If
                        If m_bExit Then Exit Sub
                    Loop
                End If
    
    'and here's the sub where I'm getting the error
    Private Sub NextTable()
        Dim rsOrg As ADODB.Recordset
        Dim sSQL As String
        Dim lTID() As Long
        Dim bFound As Boolean
        Dim lCnt As Long
        Dim lMCnt As Long
        Dim lX As Long
        Dim sTest As String
        Dim lCaIDnew As Long
        
        If m_lItenCnt Then
    ' I get the error here
            rsIm.MoveNext 
        End If
        m_lItenCnt = m_lItenCnt + 1
    
    'filtering and list loading happens below here
    Last edited by longwolf; Oct 19th, 2008 at 01:31 PM.

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