Results 1 to 6 of 6

Thread: Error adding item to ListView [Resolved]

Threaded View

  1. #1

    Thread Starter
    Bouncy Member darre1's Avatar
    Join Date
    May 2001
    Location
    Peterborough, UK
    Posts
    3,828

    Error adding item to ListView [Resolved]

    Hi guys, i'm using a listview for the first time...

    this is my code to add to a listview (2 of them)

    VB Code:
    1. Private Sub ShowRecordLists()
    2. On Error GoTo ErrorHandler
    3.  
    4.     'goes through each record and adds it to the correct listview
    5.    
    6.     rstCalls.MoveFirst
    7.     lvwCompleted.ListItems.Clear
    8.     lvwOutstanding.ListItems.Clear
    9.    
    10.     Do Until rstCalls.EOF = True
    11.         If rstCalls!booCompleted Then
    12.             'ERROR ON LINE BELOW
    13.             lvwCompleted.ListItems.Add , rstCalls!txtID, rstCalls!dtmDateLogged & vbTab _
    14.                 & rstCalls!txtCallerName & vbTab & rstCalls!txtReason
    15.         Else
    16.             lvwOutstanding.ListItems.Add , rstCalls!txtID, rstCalls!dtmDateLogged & vbTab _
    17.                 & rstCalls!txtCallerName & vbTab & rstCalls!txtReason
    18.         End If
    19.         rstCalls.MoveNext
    20.     Loop
    21.    
    22.     Exit Sub
    23.  
    24. ErrorHandler:
    25.     MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure ShowRecordLists of Form frmCallLog"
    26. End Sub

    the error is 35603 Invalid Key.

    the value of rstCalls!txtID at this point is "000010"

    the Key parameter is expecting a string expression and rstCalls!txtID is a text field, so i dont see the problem...
    Last edited by darre1; May 1st, 2002 at 08:19 AM.
    Confucious say, "Man standing naked in biscuit barrel not necessarily ****ing crackers."

    Don't forget to format your code in your posts

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