P. 1
Código Programa Alumnos con Base de Datos Access

Código Programa Alumnos con Base de Datos Access

|Views: 1.113|Likes:
Publicado porricardo037
Código en Visual Basic
Código en Visual Basic

More info:

Categories:Topics, Art & Design
Published by: ricardo037 on Sep 06, 2010
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less

10/26/2012

pdf

text

original

Código Programa Alumnos con Base de Datos Access

Private Sub CmdGuardar_Click(Index As Integer) Select Case Index Case Is = 0 rsnotas.Recordset.MoveLast 'Último Registro Case Is = 1 rsnotas.Recordset.MoveFirst ' Primer registro Case Is = 2 If Not rsnotas.Recordset.EOF = True Then rsnotas.Recordset.MoveNext 'Vuelve siguiente registro Else MsgBox "LLEGO AL ÙLTIMO REGISTRO", vbCritical rsnotas.Recordset.MoveLast 'ULTIMO End If Case Is = 3 If Not rsnotas.Recordset.BOF = True Then rsnotas.Recordset.MovePrevious 'UN REGISTRO ATRÁS Else MsgBox " LLEGO AL PRIMER REGISTRO", vbCritical rsnotas.Recordset.MoveNext 'AVANZA UN REGISTRO End If Case Is = 4 'Botón Nuevo rsnotas.Recordset.AddNew 'deshabilitar los controles CmdGuardar(0).Enabled = False CmdGuardar(1).Enabled = False CmdGuardar(2).Enabled = False CmdGuardar(3).Enabled = False

CmdGuardar(5).Enabled = False CmdGuardar(6).Enabled = False CmdGuardar(7).Enabled = False Text2.SetFocus Case Is = 5 Dim MENSAJE As Integer On Error GoTo DeleteErr MENSAJE = MsgBox(" Està seguro de querer borrar el registro?", vbYesNo, "Eliminar el registro") If MENSAJE = vbYes Then With rsnotas.Recordset .Delete .MoveNext If .EOF Then .MoveLast End With End If Exit Sub DeleteErr: MsgBox Err.Description Case Is = 6 rsnotas.Refresh ' para limpiar el control recordset Dim BUSCA As String ' Variable para buscar el nombre o apellido If Option1.Value = True Then ' pregunto si esta seleccionada la opción apellido BUSCA = InputBox("Ingrese EL APELLIDO") ' ventana ingreso apellido rsnotas.Recordset.Find _ "APELLIDO='" & BUSCA & "'" BUSCA = "" If Text2.Text = "" Then _ MsgBox "No se encontro el registro" ElseIf Option2.Value = True Then BUSCA = InputBox("Ingrese EL NOMBRE") rsnotas.Recordset.Find _ "NOMBRE='" & BUSCA & "'" If Text3.Text = "" Then _ MsgBox "No se encontro el registro" End If Case Is = 7 End

Case Is = 8 CmdGuardar(0).Enabled = True 'habilitar los controles CmdGuardar(1).Enabled = True CmdGuardar(2).Enabled = True CmdGuardar(3).Enabled = True CmdGuardar(5).Enabled = True CmdGuardar(6).Enabled = True CmdGuardar(7).Enabled = True rsnotas.Recordset.MovePrevious 'UN REGISTRO ATRÁS End Select End Sub Private Sub CmdGuardar_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single) Select Case Index Case Is = 0 CmdGuardar(0).Caption = "Último" Case Is = 2 CmdGuardar(2).Caption = "Siguiente"

End Select End Sub Private Sub Command1_Click() If Not rsnotas.Recordset.EOF = True Then Adodc1.Recordset.MoveNext Else MsgBox ("LLEGO AL ÚLTIMO REGISTRO"), vbCritical rsnotas.Recordset.MoveLast End If End Sub Private Sub Frame2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) CmdGuardar(0).Caption = "" CmdGuardar(2).Caption = "" End Sub Private Sub Text1_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then Text2.SetFocus KeyAscii = 0 End If End Sub

Private Sub Text2_Change() Text2.Text = UCase(Text2.Text) Text2.SelStart = Len(Text2.Text) End Sub Private Sub Text2_KeyPress(KeyAscii As Integer) Select Case KeyAscii Case 65 To 90, 97 To 122, 8, 44, 32, 13, 9 Case Else MsgBox "DATOS INCORRECTOS" KeyAscii = 0 End Select If KeyAscii = 13 Then Text3.SetFocus KeyAscii = 0 End If End Sub Private Sub Text3_Change() Text3.Text = UCase(Text3.Text) Text3.SelStart = Len(Text3.Text) End Sub Private Sub Text3_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then Text4.SetFocus KeyAscii = 0 End If End Sub Private Sub Text4_KeyPress(KeyAscii As Integer) Select Case KeyAscii Case 48 To 57, 8, 45, 13 Case Else MsgBox "INFORMACIÓN INGRESADA INCORRECTA" KeyAscii = 0 End Select If KeyAscii = 13 Then CmdGuardar(0).SetFocus KeyAscii = 0 End If End Sub Profesor.: Ricardo Viqueira – Materia Laboratorio de Computación III – Cens 52

You're Reading a Free Preview

Descarga
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->