Overcoming Length Problems

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am populating a multi-columned list box from a query that produces
(currently) 56 rows with a total string length of 2,813 characters. I keep
getting "The setting for this property is too long" when I execute the form.

When I limit the number of entries to under 38 (string length of 1800), it
works fine. I tried to split the query and append the box, but get the same
error. Code is:

Do While Not rec.EOF
strValue = rec("Name") & ";" & rec("City") & ";" & rec("Phone") & ";"
rec.MoveNext
Loop

lstVendorNames.RowSourceType = "Value List"
lstVendorNames.RowSource = strValues


How do you overcome this length problem?
 
By not using a value list. Change the RowSourceType to Table/Query and
assign the SQL statement you're using to open the recordset to the RowSource
property.

(In recent versions of Access, you can also assign a recordset directly to
the Recordset property of a list box or combo box, but I have not used this
feature enough to recommend either for or against it.)

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 
Perfect lad - Thanks much!

Brendan Reynolds said:
By not using a value list. Change the RowSourceType to Table/Query and
assign the SQL statement you're using to open the recordset to the RowSource
property.

(In recent versions of Access, you can also assign a recordset directly to
the Recordset property of a list box or combo box, but I have not used this
feature enough to recommend either for or against it.)

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 
I am populating a multi-columned list box from a query that produces
(currently) 56 rows with a total string length of 2,813 characters. I keep
getting "The setting for this property is too long" when I execute the form.

When I limit the number of entries to under 38 (string length of 1800), it
works fine. I tried to split the query and append the box, but get the same
error. Code is:

in Access2000 the limit is ~2000

2002 can hold over 4000 (I don't know the limit, my largest string was
4000 and found the same problem as you in the 2000 version)
 
Back
Top