Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

List Box Row Source Type

Posted on 2004-04-19
11
Medium Priority
?
584 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 200 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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 …
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

885 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