?
Solved

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

Posted on 2012-07-22
5
Medium Priority
?
3,192 Views
Last Modified: 2012-07-23
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

0
Comment
Question by:crystal_Tech
  • 3
  • 2
5 Comments
 
LVL 15

Expert Comment

by:eemit
ID: 38211936
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
0
 
LVL 1

Author Comment

by:crystal_Tech
ID: 38211957
Thanks for reply

Its not going for another record..
form this line
                Do Until RsRecList.EOF
its not going for next record..
0
 
LVL 15

Expert Comment

by:eemit
ID: 38211968
Add:
    RsRecList.MoveFirst
below the line:
    If RsRecList.RecordCount > 0 Then   '5 records
0
 
LVL 15

Accepted Solution

by:
eemit earned 2000 total points
ID: 38211990
If RsRecList is the underlying recordset of DataGrid2 then use it's fields instead of DataGrid2.Columns(n).Text
0
 
LVL 1

Author Comment

by:crystal_Tech
ID: 38216993
thanks
its working. :-)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
Suggested Courses
Course of the Month13 days, 20 hours left to enroll

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question