rs.movelast
TotalCount=rs.recordcount

解决方案 »

  1.   

    ORACLE资料中说得明明白白:如果不把记录集指针移到最后,
    RecordCount的返回值可能不正确。所以,一般先MoveLast,
    取RecordCount,然后MoveFirst。
       注意:在MoveLast之前,先要判断rs.EOF,否则,要出错。例:
    Set rs = ...... 
    With rs
       If .Eof 
          n = 0             '没有记录
       Else
          .MoveLast         '移到最后
          n = .RecordCount  '记录条数
          .MoveFirst        '移到开头
       End If
    End With