MoveNextメソッド

カーソルを次のレコードに移動します。

構文

Object.MoveNext()

引数 - Object: 必須。常にADODB RecordSetオブジェクトの名前

備考

次の例では、MoveNextメソッドの使用方法を示します。

例1:

'Create ADODB.Connection Object
Dim ConnObj   ' Create a variable.
Set ConnObj = CreateObject("ADODB.Connection")
ConnObj.Open("ConnectionString") 'Creates DB Connection by Using Connection String

Dim RecSetObj
Dim CmdTxt
CmdTxt = "SELECT * FROM EMPLOYEE_DETAILS"
Set RecSetObj = ConnObj.Execute(CmdTxt) 'Returns RecordSet

Do Until RecSetObj.Eof
'Get the Value of Columns by using Column Index or Column Name based on Use Case
RecSetObj.MoveNext() 'Move cursor to next record
Loop

RecSetObj.Close()
ConnObj.Close()
Set RecSetObj = Nothing
Set ConnObj = Nothing