Any limitation on List Box

  • Thread starter Thread starter Sunny
  • Start date Start date
S

Sunny

I am using Access2002, I have listbox on my form and trying too add items on
listbox programatically. But some times I get this message "The setting for
this property is too long."

The code where I get this message is:
MyList.AddItem (strAdd)

strAdd length is 89.
 
I believe the max length for a value based list is about 2000 characters.

So, the TOTAL length of the string used for the listbox in your case might
be over 2000 characters.

(100 row of 20 characters would for example exceed the limit).

There are several solutions.

First, a listbox is only really very useful for 15 or 30 entries. After
that...it is a very poor UI (you will torture your users...and they will not
like your software if those lists are too large).

To not have the limit of 2000 characters..then you need to use a table. You
then in place of .add new...actually add records to the table..and then do a

me.MylistBox.Requery to show the new records added.

You can all place the values into an array, or reocrdset..and load that
reocrdset to the listbox via a call back function. (this like a listbox
based on a table also does NOT have a limit of characters). Check out:

http://www.mvps.org/access/forms/frm0049.htm


And, you can also just shove sql right into the listbox datasource to pull
data from a table. So, you have a lot of choices here..but I would as a
matter of good windows UI design try and limit the number of entries in your
listbox...
 
Back
Top