eof或bof为true或当前记录已被删除的运行时错误3021. [英] Runtime error 3021 either eof or bof is true or the current record has been deleted"

查看:682
本文介绍了eof或bof为true或当前记录已被删除的运行时错误3021.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我已经在Visual Basic 6中编写了此代码.它给我错误运行时错误3021 eof或bof为true或当前记录已删除"

Hi
I have written this code in Visual Basic 6 . It is giving me error "Runtime error 3021 either eof or bof is true or the current record has been deleted"

Dim m_section As String
        If rs.RecordCount > 0 Then
             Do While Not rs.EOF
             If rs.EOF Then Exit Do
                rowcount = 1
                m_section = ""
                m_section = rs.Fields("section_id").Value
'                If m_section = "S03" Then Exit Do
                flxgd.Cols = flxgd.Cols + 1
                flxgd.ColWidth(flxgd.Cols - 1) = 2000
                flxgd.TextMatrix(0, flxgd.Cols - 1) = m_section

                    Do While (rs.Fields("section_id").Value) = m_section
                        If (flxgd.Cols - 1) = 1 Then
                            flxgd.TextMatrix(rowcount, 0) = DateValue(rs!s_date)
                        End If
                        flxgd.TextMatrix(rowcount, flxgd.Cols - 1) = rs.Fields("quantity").Value
                        rs.MoveNext
                        flxgd.Rows = flxgd.Rows + 1
                        flxgd.Row = flxgd.Row + 1
                        rowcount = rowcount + 1
                    Loop

                m_grdwidth = m_grdwidth + 2000
            Loop
        End If




谢谢




Thanks

推荐答案

'Make sure your table is not empty
If RS.RecordCount = 0 Then Exit Sub
'Make sure the Absolute Position of the record's cursor is at the right position, If not then Exit Sub
'If the Absolute Position reached the last record then Exit Sub.
If RS.AbsolutePosition = Val(RS.RecordCount) Then 
Exit Sub
End If
'Navigate [MoveNext]
RS_.MoveNext
Text1.Text = RS!FieldName1
Text2.Text = RS!FieldName2


[访问我]


这篇关于eof或bof为true或当前记录已被删除的运行时错误3021.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆