Boton Siguiente y Anterior
Publicado por Jose Francisco (34 intervenciones) el 22/11/2004 15:27:24
Hola muchachos haber si alguien me puede ayudar tengo en mi base de datos por el momento 2 registros... Entonces lo que queria probar era poner en mi pantalla un boton de siguiente y de anterior...
Boton Siguiente
Private Sub Command1_Click()
Dim siguiente As Recordset
qry = ""
qry = "Select * from tblcalibracion"
Set siguiente = DB_S.OpenRecordset(qry, dbOpenSnapshot, 64)
siguiente.MoveNext
If siguiente.RecordCount > 0 Then
Text1.Text = siguiente!Equipo
Text2.Text = siguiente!siguiente_cal
Text3.Text = siguiente!serial
End If
End Sub
Boton Anterior
Private Sub Command2_Click()
Dim anterior As Recordset
qry = ""
qry = "Select * from tblcalibracion"
Set anterior = DB_S.OpenRecordset(qry, dbOpenSnapshot, 64)
anterior.MovePrevious
If anterior.RecordCount > 0 Then
Text1.Text = anterior!Equipo
Text2.Text = anterior!siguiente_cal
Text3.Text = anterior!serial
End If
End Sub
Bueno el problema surge en el boton de anterior, ya que el de siguiente si funciona y por lo tanto me trae el siguiente registro en mi base de datos que es el segundo.... Pero cuando le doy anterior para que se regrese al primero me marca un error en la linea "Text1.Text = anterior!Equipo" donde dice "Run Time error "3021" No currente Record" y no se porque sea... Alguien me puede ayudar
Boton Siguiente
Private Sub Command1_Click()
Dim siguiente As Recordset
qry = ""
qry = "Select * from tblcalibracion"
Set siguiente = DB_S.OpenRecordset(qry, dbOpenSnapshot, 64)
siguiente.MoveNext
If siguiente.RecordCount > 0 Then
Text1.Text = siguiente!Equipo
Text2.Text = siguiente!siguiente_cal
Text3.Text = siguiente!serial
End If
End Sub
Boton Anterior
Private Sub Command2_Click()
Dim anterior As Recordset
qry = ""
qry = "Select * from tblcalibracion"
Set anterior = DB_S.OpenRecordset(qry, dbOpenSnapshot, 64)
anterior.MovePrevious
If anterior.RecordCount > 0 Then
Text1.Text = anterior!Equipo
Text2.Text = anterior!siguiente_cal
Text3.Text = anterior!serial
End If
End Sub
Bueno el problema surge en el boton de anterior, ya que el de siguiente si funciona y por lo tanto me trae el siguiente registro en mi base de datos que es el segundo.... Pero cuando le doy anterior para que se regrese al primero me marca un error en la linea "Text1.Text = anterior!Equipo" donde dice "Run Time error "3021" No currente Record" y no se porque sea... Alguien me puede ayudar
Valora esta pregunta


0