Results 1 to 2 of 2

Thread: Help please....cannot delete

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2005
    Posts
    185

    Help please....cannot delete

    Dear Experts,

    Has anyone could help me please to fix this code...it always failed I tried many time?...This is a "Delete" button, when I press this button, it should be delete row/item on the database...but it always failed....here is the code:

    VB Code:
    1. Private Sub CommandButton3_Click()
    2.  
    3.  Dim con As ADODB.Connection
    4.     Set con = New ADODB.Connection
    5.     con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\exercise.mdb"
    6.    
    7.     Set rst = Execute_SQL_ReturnRecordSet("Select * from Item", False, "C:\exercise.mdb")
    8.    
    9.          rst.MoveFirst
    10. Do While rst.EOF = False
    11.     If UserForm1.txtqty.Text = rst.Fields("Item_Code").Value Then
    12.        Exit Do
    13.     End If
    14.     rst.MoveNext
    15. Loop
    16.  
    17.     TextBox3.Text = rst.Fields("Qty")
    18.        
    19.     Application.ScreenRefresh
    20. End Sub

    When I select item no 1 (using a combo box), then when I press "Check Current Stock" it show its Qty which is "1"...BUT, when I select other item numbers, let say item code number 3 it still show the Qty for item number 1...???....

    Please help with code corrections...

    Thank you so much...

    Jennifer

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Help please....cannot delete

    If you have any comments to help zach007, please post in the other copy of this thread here.

    zach007, please do not post duplicate threads.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width