Se ha Producido el error "3265" En tiempo de ejecu
Publicado por InuYasha (3 intervenciones) el 22/05/2008 22:51:40
QUIERO HACER UN BOTON "ANTERIOR Y SIGUIENTE" SOLO QUE CUANDO EJECUTO EL CODIGO ME ARROJA UN ERROR LLAMADO
Se ha Producido el error "3265" En tiempo de ejecucion:
No se encontro el elemento en la coleccion que corresponde con el nombre o el ordinal pedido.
***********************************************************
Sub Conectar
Public datConnection As ADODB.Connection
Public recSet As ADODB.Recordset
Public strDB As String
strDB = "C:/bd1.mdb"
Set datConnection = New ADODB.Connection
Set recSet = New ADODB.Recordset
datConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source =" & strDB & ";"
End Sub
Private Sub Anterior_Click()
Call Conectar
With recSet
.ActiveConnection = datConnection
.LockType = adLockReadOnly
.CursorType = adOpenStatic
.Open "SELECT Id FROM Empleados WHERE Clave='" & TextBox1 & "'"
End With
recSet.MovePrevious
If recSet.EOF Then
MsgBox "No hay registros anteriores"
Else
TextBox1 = recSet("Clave")
TextBox2 = recSet("Nombre")
ComboBox1 = recSet("Departamento")
ComboBox2 = recSet("ComisionGrupal")
ComboBox3 = recSet("PCom2UD")
TextBox3 = recSet("Sueldo")
End If
Set recSet = Nothing
datConnection.Close: Set datConnection = Nothing
End Sub
Se ha Producido el error "3265" En tiempo de ejecucion:
No se encontro el elemento en la coleccion que corresponde con el nombre o el ordinal pedido.
***********************************************************
Sub Conectar
Public datConnection As ADODB.Connection
Public recSet As ADODB.Recordset
Public strDB As String
strDB = "C:/bd1.mdb"
Set datConnection = New ADODB.Connection
Set recSet = New ADODB.Recordset
datConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source =" & strDB & ";"
End Sub
Private Sub Anterior_Click()
Call Conectar
With recSet
.ActiveConnection = datConnection
.LockType = adLockReadOnly
.CursorType = adOpenStatic
.Open "SELECT Id FROM Empleados WHERE Clave='" & TextBox1 & "'"
End With
recSet.MovePrevious
If recSet.EOF Then
MsgBox "No hay registros anteriores"
Else
TextBox1 = recSet("Clave")
TextBox2 = recSet("Nombre")
ComboBox1 = recSet("Departamento")
ComboBox2 = recSet("ComisionGrupal")
ComboBox3 = recSet("PCom2UD")
TextBox3 = recSet("Sueldo")
End If
Set recSet = Nothing
datConnection.Close: Set datConnection = Nothing
End Sub
Valora esta pregunta
0