Results 1 to 12 of 12
  1. #1
    Join Date
    Nov 2004
    Posts
    35

    Unanswered: AddItem method not available

    Please help, somebody. I have spent two days at this ...

    I want to add an item to a listbox but the AddItem method is not there. I have checked that the listbox IS a listbox and I have tried with a combo as well. I am using Access 2000 (VB6).


    Marion

  2. #2
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Quote Originally Posted by MarionCTS
    Please help, somebody. I have spent two days at this ...

    I want to add an item to a listbox but the AddItem method is not there. I have checked that the listbox IS a listbox and I have tried with a combo as well. I am using Access 2000 (VB6).


    Marion
    That is correct. AddItem is not available under 2000. You have to go with a value list and build the string yourself or go with a table/query and bind the listbox to a table or query ...
    Back to Access ... ADO is not the way to go for speed ...

  3. #3
    Join Date
    Nov 2004
    Posts
    35

    AddItem not available

    Thanks (I was using AddItem in VB 1?, 2? 3? ... way back ...)

    What is the syntax for Value? myLst.Value = myVariable?

    Thanks
    Marion

  4. #4
    Join Date
    Nov 2004
    Posts
    35

    Got it, thanks

    Don't worry - I got it thanks

    Marion

  5. #5
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    not sure about this
    I thought in 2000 you could add items to a list box by appending onto the list boxes rowsource (providing of course its a value list not a bound column)

  6. #6
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Quote Originally Posted by healdem
    not sure about this
    I thought in 2000 you could add items to a list box by appending onto the list boxes rowsource (providing of course its a value list not a bound column)
    You can ... But, it's NOT the AddItem method (which exists in 2002 and up) ...
    Back to Access ... ADO is not the way to go for speed ...

  7. #7
    Join Date
    Nov 2004
    Posts
    35

    AddItem Method not available

    What I did was this, and it works:

    myList.RowSourceType = "Value List"
    myList.RowSource = Chr(34) & myVar1 & Chr(34) & ";" & Chr(34) & myVar2 & Chr(34)

    Regards
    Marion

  8. #8
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    yup
    thought you could.....

  9. #9
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Marion,

    One thing you need to be aware of: there is a hard limit to comboboxes using the value list of A TOTAL OF 2000 characters (which includes the separators) ... Also, this precludes having embedded commas with the data being selected ...
    Back to Access ... ADO is not the way to go for speed ...

  10. #10
    Join Date
    Nov 2004
    Posts
    35
    Thanks, but I'm hoping I won't get anywhere near the limit and I'm stripping the commas out.

    On a related matter (it's Friday evening and my brain is scrambled egg), can anyone tell me how to find out which item in the listbox (unbound) has been selected?

    Thanks again
    Marion

  11. #11
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Quote Originally Posted by MarionCTS
    Thanks, but I'm hoping I won't get anywhere near the limit and I'm stripping the commas out.

    On a related matter (it's Friday evening and my brain is scrambled egg), can anyone tell me how to find out which item in the listbox (unbound) has been selected?

    Thanks again
    Marion
    ListBox.Value

    or

    ListBox.Column(XXX,Listbox.ListIndex)

    or

    Check the ItemsSelected property for multi-select list boxes ...
    Back to Access ... ADO is not the way to go for speed ...

  12. #12
    Join Date
    Nov 2004
    Posts
    35

    Thanks

    Thanks, I'll give that a go.

    Marion

Posting Permissions

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