|
ADO Deleting a Record |
|
|
In ADO, to delete a record, first locate it. To do this, you
can create a SQL statement to locate the record. Then call the Delete method of
the ADO.Recordset class. Here is an example:
|
Private Sub cmdDeleteLast_Click()
Dim rstVideos As ADODB.Recordset
Set rstVideos = New ADODB.Recordset
rstVideos.Open "SELECT * FROM Videos WHERE Title = 'Leap of Faith'", _
CurrentProject.Connection, _
adOpenDynamic, adLockPessimistic, adCmdText
rstVideos.Delete
rstVideos.Close
Set rstVideos = Nothing
End Sub
|
|