Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2004
    Location
    London
    Posts
    46

    Question Unanswered: Runtime-error 91 with treeview

    Hiya

    I've managed to develop a nice little treeview database now, however something's really annoying me.

    I click the treeview nodes and it populates a listview activex with all the required information.. works great.. HOWEVER, when I click the root node it comes up with the annoying

    "run-time error 91"
    "object variable or With block variable not set"

    While looking for resolutions to my problem, I came across a database that does the same thing (see attached)

    Here's my code.. it's near the same as what's in the attached example..

    To get the error just click on the top node - beverages. I'm using access 2000 to develop if that helps

    thanks in advance

    ListView.ListItems.Clear

    Dim db As Database
    Dim rst As Recordset
    Dim mListItem As ListItem
    Set db = CurrentDb()
    Set rst = db.OpenRecordset("SELECT * FROM qryListItems WHERE " & _
    " Parent= '" & Node.PARENT.Text & "' AND " & _
    " Child= '" & Node.Text & "'")
    rst.MoveFirst
    Do Until rst.EOF
    Set mListItem = ListView.ListItems.Add()
    With mListItem
    .Text = rst("ListItem")
    If .Text = "Chai" Then
    .SmallIcon = "ListItem222"

    Else
    .SmallIcon = "ListItem"
    .SubItems(1) = rst("Parent")
    .SubItems(2) = rst("Child")
    .SubItems(3) = rst("Detail1")
    End If
    End With

    rst.MoveNext
    Loop


    End Sub
    Attached Files Attached Files

  2. #2
    Join Date
    Feb 2004
    Location
    London
    Posts
    46
    bumping to the top in hope of someone who knows

  3. #3
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1

    Lightbulb

    I made some changes, try this ....
    Attached Files Attached Files

  4. #4
    Join Date
    Feb 2004
    Location
    London
    Posts
    46
    again thanks much much for your help. That restructuring really helped out. Now I can get it to display all records under my top heading rather than that stupid error.

    I was starting to panic it was the version of access (the active x components)

    You've become the tree expert now! hehe

    Thanks buddy, much appreciated!!!

  5. #5
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    No I'm still learning the tree Object.....

Posting Permissions

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