Delete a single record instead of entire recordset
- From: jans__@xxxxxxxxxxx
- Date: Thu, 23 Aug 2007 04:38:24 -0700
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
.
- Follow-Ups:
- Re: Delete a single record instead of entire recordset
- From: Bob Barrows [MVP]
- Re: Delete a single record instead of entire recordset
- Prev by Date: RE: Default Value for Where Clause in Datasource
- Next by Date: Re: Delete a single record instead of entire recordset
- Previous by thread: Re: Default Value for Where Clause in Datasource
- Next by thread: Re: Delete a single record instead of entire recordset
- Index(es):
Relevant Pages
|
|