lunes, 17 de febrero de 2014

ELIMINAR DATOS


Private Sub Eliminar_Click()
Dim cs As String
    Dim sPath As String
    Dim sql As String
    Dim cn As ADODB.Connection

    sPath = ThisWorkbook.Path & "\datos.accdb"
    cs = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & sPath & ";Persist Security Info=False;"

    Set cn = New ADODB.Connection
    cn.Open cs

    sql = "DELETE FROM Estudiantes WHERE id='" & TextBox1.Text & "'"

    cn.Execute sql

    cn.Close

    Set cn = Nothing
End Sub

No hay comentarios:

Publicar un comentario