Results 1 to 9 of 9
  1. #1
    New Lounger
    Join Date
    Sep 2006
    Location
    Quilmes, Argentina
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Liscount limit (2003)

    Hi all,
    I need to count the records of my listbox.
    The problem is that the limit of the ListCount property seems to be 65535.

    Any help? Is there some property wich I don't know and can be useful to my purpose?

    Thanks!

  2. #2
    2 Star Lounger
    Join Date
    Mar 2004
    Location
    Cincinnati, Ohio, USA
    Posts
    102
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Liscount limit (2003)

    What is the row source for your list box? A query, SQL, a value list?

    The thought of a listbox with 65k entries makes my head spin. Especially if there is a Select All option.

    Does MyList.Listcount return anything? (Replacing MyList with your control name)

    -Mike

  3. #3
    New Lounger
    Join Date
    Sep 2006
    Location
    Quilmes, Argentina
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Liscount limit (2003)

    Hi Mike,

    The rowsorce is a SQL query!
    When I use MyList.Listcount returns the correct number of records if they are less than or equal to 65535 and 65535 otherwise.

    Regards!

    ps: I didn't type the "t" in the post title! <img src=/S/dizzy.gif border=0 alt=dizzy width=15 height=15>

  4. #4
    2 Star Lounger
    Join Date
    Mar 2004
    Location
    Cincinnati, Ohio, USA
    Posts
    102
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Liscount limit (2003)

    It might very well be that Listboxes (and combo boxes) are limited to 65536 items in their controls, regardless of the records returned through the SQL if run as a query.

    Out of curiosity, go to Tools-Options, Edit/Find. Do you have a setting for "Don't display lists with more than this number of records read".

    See if you can increase the number above 65,536.

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Liscount limit (2003)

    The maximum number of entries in a list box or combo box is indeed 65535 ( = 2^16 - 1). If you really need to let the user choose from more than 65536 items, it's best to break it up into several steps. For example, a first list box or combo box to select a category, then one to select a subcategory of the selected category, and one to select an item from the subcategory. This can be expanded if necessary.

    If the first list box or combo box contains 256 categories (still too much to my taste), the second one 256 subcategories and the third one 256 items, you have a total of 256 * 256 * 256 = 16,777,216 choices!

    See for example How to synchronize two combo boxes on a form in Access 2002 or in Access 2003.

  6. #6
    New Lounger
    Join Date
    Sep 2006
    Location
    Quilmes, Argentina
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Liscount limit (2003)

    Thanks both of you (Hans and Mike) for your help
    I have to admit that I'm a beginner on this subject. I don't know why I thought the limit was for the listcount instead of the listbox!
    I use the listbox to display records that match some condition chosen by the user, not to let them choose from the listbox items.
    I'd like that if the number of records ever exceeds 65535 the user will be able to know what that number is without doing an extra SQL query (in fact, we're basing our queries on a 3,3 million records table and it is very likely that they will return 65535+ records not so seldom)
    Maybe a listbox is not the appropriate tool for my form!
    Thank you anyway!

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Liscount limit (2003)

    >I use the listbox to display records that match some condition chosen by the user

    I'm sorry if this sounds harsh, but it doesn't make sense to me that you would want to display more than a few hundred records in a list box, let alone hundreds of thousands! Scrolling through the list would be a nightmare, and the overhead of loading all those records too.
    I think it would be a good idea to rethink your design.

  8. #8
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Liscount limit (2003)

    That isn't an appropriate use for a listbox. You would be better off with a datasheet or a continuous subform to display the records. Both performance and scrolling would be vastly improved. If the records need to be protected from the user, simply turn off the AllowEdit and AllowDelete properties for the form.
    Charlotte

  9. #9
    New Lounger
    Join Date
    Sep 2006
    Location
    Quilmes, Argentina
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Liscount limit (2003)

    Thank you all for your help!
    I'm going to try with charlotte's advice!
    Enjoy your weekend!

Posting Permissions

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