recordSet Vs MsFlexGrid
Hola a tod@s
¿Puede alguien decirme como elimino un registro de
un MsFlexGrid y acto seguido actualizar la bbdd
access donde se encontraba?.
Gracias
¿Puede alguien decirme como elimino un registro de
un MsFlexGrid y acto seguido actualizar la bbdd
access donde se encontraba?.
Gracias
Hola, espero que esto te ayude:
Private Sub Command1_Click()
Dim cn As ADODB.Connection
If MsgBox("¿Está seguro que desea eliminar el registro?", vbQuestion + vbYesNo, Me.Caption) = vbNo Then Exit Sub
'Se elimina de la base de datos.
Set cn = New ADODB.Connection
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "Datos.mdb;Persist Security Info=False"
cn.Open
cn.Execute "delete from Tabla where Id = " & MSHFlexGrid1.TextMatrix(MSHFlexGrid1.Row, 0)
cn.Close
Set cn = Nothing
'Se elimina el registro de la grilla
MSHFlexGrid1.RemoveItem (MSHFlexGrid1.Row)
End Sub
Private Sub Command1_Click()
Dim cn As ADODB.Connection
If MsgBox("¿Está seguro que desea eliminar el registro?", vbQuestion + vbYesNo, Me.Caption) = vbNo Then Exit Sub
'Se elimina de la base de datos.
Set cn = New ADODB.Connection
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "Datos.mdb;Persist Security Info=False"
cn.Open
cn.Execute "delete from Tabla where Id = " & MSHFlexGrid1.TextMatrix(MSHFlexGrid1.Row, 0)
cn.Close
Set cn = Nothing
'Se elimina el registro de la grilla
MSHFlexGrid1.RemoveItem (MSHFlexGrid1.Row)
End Sub
