Results 1 to 12 of 12

Thread: Please Help. Need INfo

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2011
    Location
    CLOUD 9
    Posts
    40

    Please Help. Need INfo

    Hi Guys, Need Help With This

    I have got a listview that shows the information loaded from a database.. running through Ado Data Control.

    I can get new items added fine, and updating the database is good.. but when it comes to removeing the selected item, it always deletes the first item and not the selected.

    I even set the program to set 4 labels with the information of the selected item and then ado run it through them. It finds the first label and checks the rest of the fields against labels 2 - 4. And it always finds it... but then removes the first item in the list??

    I even tried it to just remove it from the information on label 1... i set two items on the list.. one said wages, other said benefits... i clicked on benefits and it deleted wages??

    My Coding is very very bad, but i just want to get it to work for now, then i will cut it down and make it neat. Code is below: (Note:Income1 = Listview
    )
    vb Code:
    1. Private Sub Command3_Click()
    2. If Adodc1.Recordset.BOF = False Then Adodc1.Recordset.MoveFirst
    3. Label1.Caption = Income1.SelectedItem
    4. Label2.Caption = Income1.SelectedItem.SubItems(1)
    5. Label3.Caption = Income1.SelectedItem.SubItems(2)
    6. Label4.Caption = Income1.SelectedItem.SubItems(3)
    7. Adodc1.Recordset.Find "Income = '" & Label1.Caption & "'"
    8. If Adodc1.Recordset.Fields!Date = Label2.Caption _
    9.     And Adodc1.Recordset.Fields!Amount = Label3.Caption _
    10.     And Adodc1.Recordset.Fields!Frequency = Label4.Caption Then
    11.     Adodc1.Recordset.Delete
    12.     Adodc1.Recordset.MoveFirst
    13. Else
    14.     MsgBox "Not Item Found", vbOKOnly + vbExclamation, "Error27"
    15. End If
    16. End Sub


    I choose to post it here as i do not know if it is a listview problem or a database error?
    Last edited by Hack; Aug 19th, 2011 at 09:59 AM. Reason: Added Highlight Tags and some indenting

Tags for this Thread

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