Programación > Visual Basic 6.0 y anteriores
quien me explica que dice este codigo (principiante)
xax:
sera porque estoy trabajando con acces 2007? cuando lo paso a 2003 .mbd cuando deberia ser .accdb... como hago para que sea .accdb pero formato 2003... como para probar. q opinan?
Código: You are not allowed to view links.
Register or LoginPrivate Sub btnBuscar_Click()
cedula = InputBox("Ingrese la Cédula del Cliente: ", "SysFIC")
If cedula = "" Then
MsgBox "Tiene que ingresar la Cédula", vbInformation, "SysFIC"
Else
adoCliente.Refresh
Do While Not adoCliente.Recordset.EOF
If Trim(cedula) = Trim(adoCliente.Recordset!cedula) Then
MsgBox "Cliente Localizado", vbInformation, "SysFIC"
Exit Sub
End If
adoCliente.Recordset.MoveNext
If adoCliente.Recordset.EOF Then
adoCliente.Recordset.MoveLast
MsgBox "Cliente No Localizado", vbExclamation, "SysFIC"
Exit Sub
End If
Loop
End If
End Sub
Private Sub btnCancelar_Click()
On Error GoTo cancelar
adoCliente.Recordset.CancelUpdate
Call deshabilitar
Call deshabilitarbot
adoCliente.Recordset.MoveFirst
Exit Sub
cancelar: MsgBox Err.Description, vbCritical, "SysFIC"
End Sub
Private Sub btnEliminar_Click()
On Error GoTo eliminar
adoCliente.Recordset.Delete
adoCliente.Recordset.MoveFirst
Exit Sub
eliminar: MsgBox Err.Description, vbCritical, "SysFIC"
End Sub
Private Sub btnGuardar_Click()
On Error GoTo guardar
If validar = True Then
adoCliente.Recordset.Update
deshabilitar
deshabilitarbot
End If
Exit Sub
guardar:
If Err.Number = -2147467259 Then
MsgBox "La cédula ingresada ya está registrada, por favor verifique los datos", vbInformation, "SysFIC"
txtCedula.SetFocus
SendKeys "{Home}+{End}"
Else
MsgBox Err.Description, vbCritical, "SysFIC"
End If
End Sub
Private Sub btnModificar_Click()
habilitar
habilitarbot
txtCedula.Enabled = False
btnModificar.Enabled = True
txtNombres.SetFocus
End Sub
Private Sub btnNuevo_Click()
On Error GoTo nuevo
adoCliente.Recordset.AddNew
habilitar
habilitarbot
txtCedula.SetFocus
Exit Sub
nuevo: MsgBox Err.Description, vbCritical, "SysFIC"
End Sub
Public Sub habilitar()
txtCedula.Enabled = True
txtNombres.Enabled = True
txtApellidos.Enabled = True
txtCiudad.Enabled = True
txtDireccion.Enabled = True
txtTelefono.Enabled = True
End Sub
Public Sub deshabilitar()
txtCedula.Enabled = False
txtNombres.Enabled = False
txtApellidos.Enabled = False
txtCiudad.Enabled = False
txtDireccion.Enabled = False
txtTelefono.Enabled = False
End Sub
Public Sub habilitarbot()
btnNuevo.Enabled = False
btnGuardar.Enabled = True
btnModificar.Enabled = False
btnEliminar.Enabled = False
btnCancelar.Enabled = True
btnSalir.Enabled = False
adoCliente.Enabled = False
End Sub
Public Sub deshabilitarbot()
btnNuevo.Enabled = True
btnGuardar.Enabled = False
btnModificar.Enabled = True
btnEliminar.Enabled = True
btnCancelar.Enabled = False
btnSalir.Enabled = True
adoCliente.Enabled = True
End Sub
Private Sub btnSalir_Click()
Unload Me
End Sub
Private Sub txtApellidos_KeyPress(KeyAscii As Integer)
If (KeyAscii >= Asc("a") And KeyAscii <= Asc("z")) Or (KeyAscii >= Asc("A") And KeyAscii <= Asc("Z")) Or KeyAscii = 32 Or KeyAscii = 8 Then
KeyAscii = Asc(UCase(Chr(KeyAscii)))
Else
KeyAscii = 0
End If
End Sub
Private Sub txtCedula_KeyPress(KeyAscii As Integer)
If KeyAscii < Asc("0") Or KeyAscii > Asc("9") Then
If KeyAscii <> 8 Then
KeyAscii = 0
End If
End If
End Sub
Private Sub txtCiudad_KeyPress(KeyAscii As Integer)
If (KeyAscii >= Asc("a") And KeyAscii <= Asc("z")) Or (KeyAscii >= Asc("A") And KeyAscii <= Asc("Z")) Or KeyAscii = 32 Or KeyAscii = 8 Then
KeyAscii = Asc(UCase(Chr(KeyAscii)))
Else
KeyAscii = 0
End If
End Sub
Private Sub txtNombres_KeyPress(KeyAscii As Integer)
If (KeyAscii >= Asc("a") And KeyAscii <= Asc("z")) Or (KeyAscii >= Asc("A") And KeyAscii <= Asc("Z")) Or KeyAscii = 32 Or KeyAscii = 8 Then
KeyAscii = Asc(UCase(Chr(KeyAscii)))
Else
KeyAscii = 0
End If
End Sub
Private Sub txtSeleccionar_Click()
frmFactura.txtCedula.Text = txtCedula.Text
Unload Me
End Sub
Private Sub txtTelefono_KeyPress(KeyAscii As Integer)
If KeyAscii < Asc("0") Or KeyAscii > Asc("9") Then
If KeyAscii <> 8 Then
KeyAscii = 0
End If
End If
End Sub
Function validar() As Boolean
If Len(txtCedula.Text) < 8 Then
MsgBox "El Campo CÉDULA debe tener 8 dígitos", vbInformation, "SysFIC"
validar = False
txtCedula.SetFocus
Exit Function
End If
If validarcedula(txtCedula.Text) = False Then
MsgBox "El Campo CÉDULA es Incorrecto por favor ingreselo nuevamente", vbInformation, "SysFIC"
validar = False
txtCedula.SetFocus
Exit Function
End If
If txtNombres.Text = "" Then
MsgBox "El Campo NOMBRES es requerido", vbInformation, "SysFIC"
validar = False
txtNombres.SetFocus
Exit Function
End If
If txtApellidos.Text = "" Then
MsgBox "El Campo APELLIDOS es requerido", vbInformation, "SysFIC"
validar = False
txtApellidos.SetFocus
Exit Function
End If
If txtCiudad.Text = "" Then
MsgBox "El Campo CIUDAD es requerido", vbInformation, "SysFIC"
validar = False
txtCiudad.SetFocus
Exit Function
End If
If txtDireccion.Text = "" Then
MsgBox "El Campo DIRECCIÓN es requerido", vbInformation, "SysFIC"
validar = False
txtDireccion.SetFocus
Exit Function
End If
If txtTelefono.Text = "" Then
MsgBox "El Campo TELÉFONO es requerido", vbInformation, "SysFIC"
validar = False
txtTelefono.SetFocus
Exit Function
Else
validar = True
End If
End Function
--- Fin del código ---
EddyW:
Wenas,
Repito una vez más lee las reglas del foro. >:(
Edita el primer mensaje y coloca el icono del mensaje y los códigos en las etiquetas code
Así:
[code=vb]
' Aquí encierras tu código
[/code]
Ahora no tengo VB6 mucho menos el Access Dx cuando llegue a casa lo analizo bien ;)
Creo que deberías exportar la DB desde el Access 2007 como MBD para 2003, o si quieres puedes buscar el Pack de compatibilidad para Office 2003 con archivos de Office 2007 (Incluido Access), (Pesa unos 30Mb, de la página oficial de Microsoft) te aconsejo mejor exportar o guardar la DB desde Access 2007 para 2003 ;)
SaluDOS!!!
xax:
no se como pasar acces 2007 a 2003 y q el formato lo lea visual basic s) s)
EddyW:
Wenas,
Click en el Menú (Logo de Office)/Guardar Como..., seleccionar "Base da Datos de Office 2002 - 2003" ;)
Para acceder a la base de datos desde VB6, usa el control ADO u ADOBC
SaluDOS!!!
javrian:
mi amigo, queria saber si pudiste solucionar el error ya que tengo el mismo problema por lo que no puedo ejecutar el programa y me interesa muchisimo para mi negocio. sin mas y agradeciendo por adelantado me despido ;D
Navegación
[#] Página Siguiente
[*] Página Anterior
Ir a la versión completa