Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / Database Access / August 2007



Tip: Looking for answers? Try searching our database.

Delete single record NOT INTIRE RECORDSET?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jans__@hotmail.com - 23 Aug 2007 12:34 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.