Escolar Documentos
Profissional Documentos
Cultura Documentos
BOF
y EOF
Para
Un
Dim cn As Connection
Dim rst As Recordset
Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
If Not rst Is Nothing Then
If rst.State = adStateOpen Then rst.Close
Set rst = Nothing
End If
If Not cn Is Nothing Then
If cn.State = adStateOpen Then cn.Close
Set cn = Nothing
End If
End Sub
Desconectar
cn.Open cadena
Set rst = New Recordset
rst.Open "Select * FROM Contacto", cn, adOpenStatic, adLockOptimistic
If
txt_Field(0).DataField = "Nombre"
txt_Field(1).DataField = "Apellido"
txt_Field(2).DataField = "Email"
Call Setear_TextBox
End
Sub
Fin Load
App.path,Devuelve
la
la
ruta donde
carpeta del
Terminologas
Rst,AddNew,
Terminologas
Dim i As Integer
For i = 0 To Command1.Count - 1
Command1(i).Enabled = Not Command1(i).Enabled
Next
For i = 0 To cmdNav.Count - 1
cmdNav(i).Enabled = Not cmdNav(i).Enabled
Next
End Sub
Funciones
Creadas
Funciones
Creadas
Sub cmdNormal()
DeshabilitarTodosCmd
Command1(0).Enabled =
True
Command1(1).Enabled =
True
Command1(3).Enabled =
True
End Sub
Sub cmdSinRegistros()
DeshabilitarTodosCmd
Command1(0).Enabled =
True
End Sub
Sub cmdEditar()
DeshabilitarTodosCmd
Command1(2).Enabled
True
Command1(4).Enabled
True
Command1(5).Enabled
True
Command1(6).Enabled
True
End Sub
=
=
=
=
Sub CmdNuevo()
DeshabilitarTodosCmd
Command1(2).Enabled = True
Command1(4).Enabled = True
Command1(5).Enabled = True
Command1(6).Enabled = True
End Sub
Sub DeshabilitarTodosCmd()
Command1(0).Enabled = False
Command1(1).Enabled = False
Command1(2).Enabled = False
Command1(3).Enabled = False
Command1(4).Enabled = False
Command1(5).Enabled = False
Command1(6).Enabled = False
End Sub
button
Matriz de Comandos
CASE 1
Picture1.Cls
'Elimina el archivo de la carpeta de imagenes
If rst(Field_Img) <> "" Then
Call Kill(Carpeta_IMG & rst(Field_Img))
End If
rst.Delete
If rst.RecordCount > 0 Then
cmdNormal
Else
cmdSinRegistros
End If
CASE 2
' Botn Actualizar los cambios en la base de
datos
Case 2
If Not rst.EOF And Not rst.BOF Then
rst.Update
Guardar_Imagen
cmdNormal Funcin que habilita
los botones
End If
CASE 3
CASE 4
Case 5
Case 5
With CommonDialog1
.DialogTitle = " Seleccionar imagen"
.Filter = "BMP|*.bmp|JPEG|*.jpeg|GIF|*.gif|JPG|*.jpg|Todos|*.*"
.ShowOpen
If .FileName = "" Then
Exit Sub
Else
' Graba el nombre en el campo, el id de imagen _
que es el mismo que el campo Id
rst(Field_Img) = rst!id '
Case 6
' Limpia la imagen del Picture y Elimina el id de _
imagen del registro actual de la base
Case 6
Setear_TextBox
' Muestra la imagen
Mostrar_Imagen
End Sub
Para
agregar
el modulo de
construir la
imagen
nuevamente.
Este
cdigo
se
lo
utilizar para
el manejo de
imgenes.
Clic en
PROYECTO
/Agregar Modulo
Escoger
existente.
Buscar la ruta
donde lo
tengamos
guardado o
descargado.
Clic en abrir
Y automaticamente se incluira en
nuestro proyecto
Base
de datos.
Archivo
Guardar y
publicar como
base de datos
2000, mdb
Crear