Mira como está compuesto el Form
Código PHP:
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Private Sub cmdAnterior_Click()
rs.MovePrevious
cmdSiguiente.Enabled = True
desabilitar
If rs.BOF = True Then
rs.MoveFirst
cmdPrimero.Enabled = False
cmdAnterior.Enabled = False
Else
refrescar
End If
End Sub
Private Sub cmdBuscar_Click()
Load frmBuscarEliminar
frmBuscarEliminar.Show vbModal
txtNombre = Nombre
End Sub
Private Sub CmdEliminar_Click()
If Trim(txtNombre.Text) = "" Then
MsgBox "Base de Datos sin Contactos", vbInformation, "Información"
txtNombre.SetFocus
Exit Sub
End If
rs.Delete
rs.MoveNext
If rs.EOF Then
rs.MoveLast
End If
Unload Me
Load frmEliminar
frmEliminar.Show vbModal
End Sub
Private Sub cmdPrimero_Click()
rs.MoveFirst
refrescar
desabilitar
End Sub
Private Sub cmdSiguiente_Click()
rs.MoveNext
desabilitar
If rs.EOF = True Then
rs.MoveLast
cmdUltimo.Enabled = False
cmdSiguiente.Enabled = False
Else
refrescar
End If
End Sub
Private Sub cmdUltimo_Click()
rs.MoveLast
refrescar
desabilitar
End Sub
Private Sub Form_Load()
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
cn.Open "Driver={Microsoft Access Driver (*.mdb)};Dbq=" & App.Path & "\Directorio.mdb ;Admin=Admin;Pwd=896576560;"
rs.ActiveConnection = cn
rs.CursorType = adOpenKeyset
rs.Open "Select * From Directorio", cn, adOpenStatic, adLockOptimistic
Label7.Caption = rs.RecordCount & " Contactos Agregados a su lista"
Set txtNombre.DataSource = rs
txtNombre.DataField = "Nombre"
Set txtTelefono.DataSource = rs
txtTelefono.DataField = "Telefono"
Set txtFax.DataSource = rs
txtFax.DataField = "Fax"
Set txtEmail.DataSource = rs
txtEmail.DataField = "Email"
Set txtDireccion.DataSource = rs
txtDireccion.DataField = "Direccion"
If Ok Then txtNombre.SetFocus
End Sub
Private Sub cmdCancelar_Click()
Unload Me
Load frmMain
frmMain.Show vbModal
End Sub
Private Sub Form_Unload(Cancel As Integer)
cn.Close
Set cn = Nothing
End Sub
Private Sub Timer1_Timer()
Dim wkday
Dim mnthday
Dim mnth
wkday = Weekday(Now)
mnth = Month(Now)
If wkday = 1 Then
wkday = "Domingo"
ElseIf wkday = 2 Then
wkday = "Lunes"
ElseIf wkday = 3 Then
wkday = "Martes"
ElseIf wkday = 4 Then
wkday = "Miércoles"
ElseIf wkday = 5 Then
wkday = "Jueves"
ElseIf wkday = 6 Then
wkday = "Viernes"
ElseIf wkday = 7 Then
wkday = "Sábado"
End If
If mnth = 1 Then
mnth = "Enero"
ElseIf mnth = 2 Then
mnth = "Febrero"
ElseIf mnth = 3 Then
mnth = "Marzo"
ElseIf mnth = 4 Then
mnth = "Abril"
ElseIf mnth = 5 Then
mnth = "Mayo"
ElseIf mnth = 6 Then
mnth = "Junio"
ElseIf mnth = 7 Then
mnth = "Julio"
ElseIf mnth = 8 Then
mnth = "Agosto"
ElseIf mnth = 9 Then
mnth = "Septiembre"
ElseIf mnth = 10 Then
mnth = "Octubre"
ElseIf mnth = 11 Then
mnth = "Noviembre"
ElseIf mnth = 12 Then
mnth = "Diciembre"
End If
Label6.Caption = Time & ", " & wkday & ", " & mnth & " " & Day(Now) & ", " & Year(Now)
End Sub
Public Sub refrescar()
txtNombre.Text = rs!Nombre
End Sub
Public Function validar() As Boolean
If rs.BOF = True Or rs.EOF = True Then
validar = False
Else
validar = True
End If
End Function
Public Sub desabilitar()
If cmdPrimero.Value = True Then
cmdSiguiente.Enabled = True
cmdUltimo.Enabled = True
cmdAnterior.Enabled = False
cmdPrimero.Enabled = False
Else
If cmdUltimo.Value = True Then
cmdSiguiente.Enabled = False
cmdUltimo.Enabled = False
cmdAnterior.Enabled = True
cmdPrimero.Enabled = True
Else
cmdSiguiente.Enabled = True
cmdUltimo.Enabled = True
cmdAnterior.Enabled = True
cmdPrimero.Enabled = True
End If
End If
End Sub
Si puedes modificalo y así aprendo
Saludos