Jugulator
8/12/2018 - 10:42 AM

Open Table As Recordset

Function OpenTableAsRecordSet(objConn As ADODB.Connection, strTable As String) As ADODB.Recordset
'Description:   Opens a DB table as Recordset
'Input:         Connection object; Table name (String)
'Output:        Recordset object

'******   DEKLARÁCIÓK   ********************
Dim adoRecSet   As ADODB.Recordset
'*******************************************

    Set adoRecSet = New ADODB.Recordset
    
    With adoRecSet
        .ActiveConnection = objConn
        .Source = strTable
        .CursorType = adOpenStatic
        .CursorLocation = adUseServer
        .LockType = adLockOptimistic      'adLockOptimistic   'adLockReadOnly
        .Open Options:=adCmdTableDirect
    End With
   
    Set OpenTableAsRecordSet = adoRecSet

End Function