Option Explicit
Private Sub Form_Open(Cancel As Integer)
Dim rs As New ADODB.Recordset
Dim cn As New ADODB.Connection
cn.ConnectionString = "Provider=SQLNCLI11;DATA SOURCE=localhost;Integrated Security=SSPI;INITIAL CATALOG=CatalogoBD"
cn.Open
rs.CursorLocation = adUseClient
'adLockPessimistic >>> registros son modificables en la bdd des de el formulario
'rs.Open "SELECT * FROM Tabla", cn, adOpenStatic, adLockPessimistic
'solo lectura >>> registros no son modificables
rs.Open "SELECT * FROM Tabla", cn, adOpenStatic, adLockReadOnly
If Not rs.EOF Then
Set Me.Recordset = rs
DoCmd.GoToRecord , , acFirst
End If
rs.Close
cn.Close
End Sub
No hay comentarios:
Publicar un comentario