Access/VBA Library

FetchRow

Retrieves data from the current record in a Recordset and returns it in a Dictionary.

Syntax

FetchRow( rs )
Parameters
Name Type Description
rs Recordset Required. Reference to an open Recordset.
Return value

Dictionary : Each field in the recordset is a key in the Dictionary.

Code
Function FetchRow(rs As Recordset) As Dictionary

    Dim result As New Dictionary
    Dim i As Long
    
    On Error Resume Next
    
    For i = 0 To rs.Fields.Count - 1
        result.Add rs.Fields(i).name, rs.Fields(i).Value
    Next i

    Set FetchRow = result
End Function

Databasetag:DatabaseSQLtag:SQLDictionarytag:Dictionary

See also

  • QueryRow
  • QueryRows