Ver Mensaje Individual
  #4 (permalink)  
Antiguo 25/10/2009, 11:42
GUTIERREZ727
 
Fecha de Ingreso: julio-2007
Mensajes: 2
Antigüedad: 16 años, 9 meses
Puntos: 0
Respuesta: Actualizar el contenido de un mshflexgrid

'A quien pueda interezar......!
'los q esta en comillas son comentarios
Private Sub ELIMINAR_Click()
If IDLOB.Text = "" Then
MsgBox "Debe ingresar Codigo de Equipo", vbExclamation, "VERIFICACION DE DATOS"
IDLOB.SetFocus
Else
Dim data As Database
Dim objeto As Recordset
Dim sql As String
Set data = OpenDatabase("SAN.MDB")
sql = "SELECT * FROM EQUIPO WHERE CODIGO_E ='" & IDLOB.Text & " ' "
Set objeto = data.OpenRecordset(sql, dbOpenDynaset)
If objeto.EOF Then
MsgBox "El Codigo:" & IDLOB.Text & " no se encuantra en la base de datos", vbExclamation, "ELIMINACION DE DATOS"
IDLOB.SetFocus
Else
With objeto
.Delete
.Close
End With
MsgBox "El Registro fue Eliminado", vbInformation, "DATOS ELIMINADOS"
LIMPIA
End If
data.Close
'con este se actualiza el msflexgrid lo anterior es ejemplo:
'////////////////////////////////////////////////////////////////////////////
LISTA.Rows = 2
LISTA.Cols = 4
LISTA.TextMatrix(LISTA.Row, 1) = ""
LISTA.TextMatrix(LISTA.Row, 2) = ""
LISTA.TextMatrix(LISTA.Row, 3) = ""
ACTUALIZAR
'////////////////////////////////////////////////////////////////////////////
End If
End Sub


'ACTUALIZAR es una funcion que esta abajo q es llamada cada vez q se necesite (Guardar, Modifica, Eliminar, Buscar)

Private Sub ACTUALIZAR()
Dim data As Database
Dim obj As Recordset
Dim sql As String
Dim i As Integer
Set data = OpenDatabase("SAN.MDB")
sql = "SELECT * FROM EQUIPO"
Set obj = data.OpenRecordset(sql, dbOpenDynaset)
LISTA.FixedCols = 1
LISTA.FixedRows = 1
i = 0
Do While Not obj.EOF
i = i + 1
LISTA.TextMatrix(i, 0) = i
LISTA.TextMatrix(i, 1) = obj!CODIGO_E
LISTA.TextMatrix(i, 2) = obj!DESCRIPCION
LISTA.TextMatrix(i, 3) = obj!POSICION
LISTA.Rows = LISTA.Rows + 1
obj.MoveNext
Loop
obj.Close
data.Close
End Sub

'Ojala les sea de probecho y acordaos de la definicion de LOGICA: "Es lo mas facil y mas obvio de hacer algo" => 0123456789...........