I would like to delete a single record, however the result of my code
is that the complete recordset is deleted
Can anyone help me out here????
Here is my code
Sub DeleteAdvisor()
Dim cnn As ADODB.Connection
Dim rst As ADODB.Recordset
Dim strSQL As String
Dim OfferDB as String
dim advisorid as string
Set cnn = New ADODB.Connection
With cnn
.Provider = "Microsoft.Jet.OLEDB.4.0"
.Open OfferDB
End With
Set rst = New ADODB.Recordset
With rst
' Open the Recordset object.
advisorid = "12"
strSQL = "SELECT * FROM Qry_Invul_Adviseur WHERE Adviseur_id = "
& advisorid
.Open Source:=strSQL, _
ActiveConnection:=cnn, _
CursorType:=adOpenKeyset, _
LockType:=adLockOptimistic
End With
rst.MoveFirst
rst.Delete
rst.Close
cnn.Close
Set rst = Nothing
Set cnn = Nothing
End Sub
argusy - 23 Aug 2007 15:37 GMT
> I would like to delete a single record, however the result of my code
> is that the complete recordset is deleted
[quoted text clipped - 41 lines]
>
> End Sub
how many records with "12" as adviseur_ID, are in qry_invul_adviseur?
Argusy