rs.open的参数需要设置,如下
rs.open sql,conn,CursorType,LockType,CommandType
默认下,rs.open的第三个参数,也就是CursorType属性是adOpenForwardOnly,所以只能一条条记录的往下检索,不能用movelast,必须设置成除adOpenForwardOnly之外的参数,才能用movelast
'---- CursorTypeEnum Values ----
Const adOpenForwardOnly = 0
Const adOpenKeyset = 1
Const adOpenDynamic = 2
Const adOpenStatic = 3
'---- LockTypeEnum Values ----
Const adLockReadOnly = 1
Const adLockPessimistic = 2
Const adLockOptimistic = 3
Const adLockBatchOptimistic = 4
'---- CommandTypeEnum Values ----
Const adCmdUnknown = &H0008
Const adCmdText = &H0001
Const adCmdTable = &H0002
Const adCmdStoredProc = &H0004
Const adCmdFile = &H0100
Const adCmdTableDirect = &H0200