recordcount 未能取得记录数With DelRs
if not .eof then
.movefirst
.moveend
        else
exit sub
end if
                    For i = 1 To .RecordCount
                        .Delete
                        .Update
                        .MoveNext
                        If .EOF Then Exit For
                    Next
 End With

解决方案 »

  1.   

    少了一句With DelRs
    if not .eof then
    .movefirst
    .moveend
            else
    exit sub
    end if
       .movefirst   
                        For i = 1 To .RecordCount
                            .Delete
                            .Update
                            .MoveNext
                            If .EOF Then Exit For
                        Next
     End With
      

  2.   

    如果你要是想全部的记录的话,试试用SQL来做.
      

  3.   

    如果你要是想删除全部的记录的话,试试用SQL来做
      

  4.   

    你在执行删除语句前移动过纪录。
    必须将纪录movefirst。
    根据你的程序
    ...
    .MoveNext
    If .EOF Then Exit For
    ...
    可以知道进入循环时肯定已经eof了。
      

  5.   

    你可以用
    MyConnection.execute "DELETE FROM mydatabase"
      

  6.   

    试试能用就给分吧
    on error resume next
    With DelRs
                        For i = 1 To .RecordCount                        .movefirst
                            .Delete
                            .Update
          
                            Next
     End With
    on error goto 0
      

  7.   

    你最好不要用这个recordset对象
    用command挺好的
    只用一个句子
    dim cmm as new adodb.command
    set cmm.ActiveConnection=myconnectioncmm.CommandText="delete form tablename"
    cmm.execute
    set cmm=nothing