'--> Abrir RecordSet con Ado Public Function AbreRS(ByVal sConsulta As String, ByVal cnSistema As ADODB.Connection, ByVal sTipoMotor As Integer) As ADODB.Recordset '--> Establecer base de datos que esta utilizando On Error GoTo ErrorAbrers
AbreRS = New ADODB.Recordset '--> SQL Server If sTipoMotor = 0 Then With AbreRS .let_Source(sConsulta) .ActiveConnection = cnSistema .CacheSize = 50 .CursorLocation = ADODB.CursorLocationEnum.adUseClient .CursorType = ADODB.CursorTypeEnum.adOpenKeyset .LockType = ADODB.LockTypeEnum.adLockOptimistic .Open() End With Else '--> Access With AbreRS .let_Source(sConsulta) .let_ActiveConnection(cnSistema) .CursorLocation = ADODB.CursorLocationEnum.adUseClient .LockType = ADODB.LockTypeEnum.adLockPessimistic .Open() End With End If Exit Function
ErrorAbrers: msg(Err.Number & " - " & Err.Description, "Reporteador", "mdoGlobal", "AbreRs") End Function