Solved

List Box Row Source Type

Posted on 2004-04-19
11
562 Views
Last Modified: 2012-05-05
If the Row Source Type of a listbox is set to Value List, what is the maximum length of the semi-colon separated string in the Row Source property?

Thanks
0
Comment
Question by:dds110
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
  • 3
11 Comments
 
LVL 44

Accepted Solution

by:
Arthur_Wood earned 50 total points
ID: 10862802
2048 characters, counting EVERY character in the string.

AW
0
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 10862864
I may be remembering that number incorrectly.  It might be 1024.
0
 
LVL 8

Expert Comment

by:Mourdekai
ID: 10863171
The limit for a listbox rowsource is 32,750 characters.  And like Arthur says, that's counting every character.
0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
LVL 8

Author Comment

by:dds110
ID: 10865403
hhmmmm!
2048, 1024, 32,750

Seems to be some disagreement going on here.

I guess I'll write me a function that adds 1 character at a time to the row source and see when it breaks.  Sad to think I didn't think of that earlier.

I'll award the points to whoever is closest.  This like that game my dad used to play with me and my sister....pick a number between 1 and 10...whoever is closest doesn't have to do the dishes.

=-)

See ya later.
0
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 10865686
I am pretty sure thsat the number is 2048, but it has been about 2 years since I encountered the issue (with Access 97).  And Mourdekai could be refering to Access 2003, which may in fact have raised the limit, though I would find the quoted number to be a bit hard to accept (if it is that large, then the correct value would be 32767, not 32750).

AW
0
 
LVL 8

Author Comment

by:dds110
ID: 10868208
OK

Here's my code:  And I failed to mention that I am using ACC97 (sorry about that).

Private Sub Command2_Click()
On Error GoTo errline:
Me.List0.RowSource = ""
Dim x As Long
For x = 1 To 50000
  Me.List0.RowSource = Me.List0.RowSource & "A"
Next
exitline:
Exit Sub
errline:
MsgBox x
MsgBox Err.Description, , Err.Number
Resume exitline:
End Sub

It threw an error when x was equal to 2049.  So aw get's the points.

However.  To be fair and all, I will try this code out at home later tonight to test Mourdekai's answer.  If it's good, I'll post a new question for you with the same amount of points.

Thanks to all.
0
 
LVL 8

Expert Comment

by:Mourdekai
ID: 10868615
My number came from the specifications for Access 2002.  I agree Arthur that the number looks a little strange not being a power of 2.  But the specifications in help say the limit is 32750 for a sql statement used in a rowsource for a control.  I wrote some code like dds110 did and I got the error after 32750.  

Don't worry about posting another question for points,
0
 
LVL 8

Author Comment

by:dds110
ID: 10871113
No dude, you deserve them.  I have no problem with it.  I asked a question, and got an answer.  I'm still gonna post the points.

I'm a giving kind of guy!

=-)

Besides, what I'm working on will have to be done in Access 2000 and Up anyway.
0
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 10871306
Mordekai, the precise statement says:

"Number of characters in an SQL statement that serves as the Recordsource or Rowsource property of a form, report, or control (both .mdb and .adp) " as 32750.

The key phrase here being:"in an SQL statement".  that is NOT what we are talking about here.  What dds110 is asking about the number of characters allowed in a VALUE LIST.  When the RowSourceType is set to "Table/Query", the query string is in fact passed to the JET engine to be executed against the database, while when the RowSourceType is "Value List", the value list itself must be parsed by the underlying VB engine, and there lies the rub.  The string from the RowSource field is passed to an internal variable, and that is limited to 1 code page (hence the 2048 character limit) .  They are NOT the same thing.

dds110-->By the way, you need to be aware of a MINOR 'gotcha' - when it comes to parsing the RowSource string.  The HELP systems says that the 'separator' between fields is the ';' (semi-colon character).  However, you will discover that the ',' (COMMA) is also treated as a field separator, ansd that will cause you great headaches if you attempt to have text, in the field values, that has legitimate embedded ',' characters. !!!!

That DOES NOT apply it the fields are coming from the output of an SQL query.

AW

0
 
LVL 8

Expert Comment

by:Mourdekai
ID: 10871443
Arthur,

     I know we are talking about the value list.  In Access 2002, the limit for a value list IS 32750 characters.  I know the help file says 'SQL statement', but the character limit still applies for the rowsource property when the rowsourcetype is value list.  It just doesn't send it to the JET engine.  

     If you have Access 2002 you can check it with code like dds110 posted above.  It will throw an error as soon as you try to put a string of length 32751 in the rowsource.  I don't know about any earlier versions, but 2002 has the 32750 limit.

Mourdekai

dds110,
You really don't need to post another Q for points.  I might be mistaken, but I don't think Points For... Q's are allowed anymore.
0
 
LVL 8

Author Comment

by:dds110
ID: 10877526
OK, no problem guys.  I'm still gonna test it with XP though.  I'll let you know in here how it goes.  Acc2000 limited me to 2048.

AW, i figured out the comma thing yesterday.  What a pain.  Anyway, after all of this, I had to change my direction with the list box anyway and use a table for the rowsource.  But not all of this was in vain.  I learned something new =-)

See ya later.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question