Link to home
Start Free TrialLog in
Avatar of Altaf Patni
Altaf PatniFlag for India

asked on

Getting run time error 3021 either BOF or EOF is true, or current record has been deleted, Requested opration...

Getting run time error 3021
either BOF or EOF is true, or current record has been deleted, Requested opration....

    If RsRecList.RecordCount > 0 Then   '5 records

        ''i want to filter above above 5 records and getting desired data 
            With RsRecList
                Do While RsRecList.EOF
                    If RsCmHama.State = 1 Then RsCmHama.Close
                    RsCmHama.Open "Select * from CmMaster where Cust = '" & Text1(11).Text & "' and From_City = '" & DataGrid2.Columns(7).Text & "' and To_City = '" & DataGrid2.Columns(8).Text & "'", con, adOpenKeyset, adLockOptimistic
                    If RsCmHama.RecordCount > 0 Then
                        If RsCmHama.Fields(4) = "CASH" Then
                            CmHamaWeight = Val(CmHamaWeight) + Val(DataGrid2.Columns(11).Text) * RsCmHama.Fields(5)
                        ElseIf RsCmHama.Fields(4) = "CREDIT" Then
                            CmHamaArt = Val(CmHamaArt) + Val(DataGrid2.Columns(3).Text) * RsCmHama.Fields(5)
                        End If
                    End If
                .MoveNext
                Loop
            End With
    End If

Open in new window

Avatar of eemit
eemit
Flag of Germany image

Change:
    Do While RsRecList.EOF
To:
    Do Until m_oRsTemp.EOF
And add this below the line "RsCmHama.Open ..." :
    If Not RsCmHama Is Nothing Then
        If RsCmHama.State = adStateOpen Then
Avatar of Altaf Patni

ASKER

Thanks for reply

Its not going for another record..
form this line
                Do Until RsRecList.EOF
its not going for next record..
Add:
    RsRecList.MoveFirst
below the line:
    If RsRecList.RecordCount > 0 Then   '5 records
ASKER CERTIFIED SOLUTION
Avatar of eemit
eemit
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thanks
its working. :-)