Sub Delete_Record()
Dim conn As ADODB.Connection
Dim myRecordset As ADODB.Recordset
Dim strConn As String
Dim strCriteria As String
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & CurrentProject.Path & "\mydb.mdb"
Set conn = New ADODB.Connection
Set myRecordset = New ADODB.Recordset
With myRecordset
.Open "Select * from Employees Where LastName ='Marco'", _
strConn, adOpenKeyset, adLockOptimistic
.Delete
.Close
End With
Set myRecordset = Nothing
Set conn = Nothing
End Sub
|