Solved

List Box Row Source Type

Posted on 2004-04-19
11
555 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
  • 4
  • 4
  • 3
11 Comments
 
LVL 44

Accepted Solution

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

AW
0
 
LVL 44

Expert Comment

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

Expert Comment

by:Mourdekai
Comment Utility
The limit for a listbox rowsource is 32,750 characters.  And like Arthur says, that's counting every character.
0
 
LVL 8

Author Comment

by:dds110
Comment Utility
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
Comment Utility
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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 8

Author Comment

by:dds110
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

728 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now