LIstbox delimiters (1 Viewer)

kirkm

Registered User.
Local time
Tomorrow, 08:57
Joined
Oct 30, 2008
Messages
1,257
Was there ever a solution found for including commas and semicolons in a (single column) listbox without them bring taken as a field delimiter?
I read that replacing a semicolin with a comma worked - but it didn't for me. Both cutoff the text.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 13:57
Joined
Oct 29, 2018
Messages
21,454
Hi. Not in front of a computer now, but have you tried using a Table/Query instead of Value List?
 

kirkm

Registered User.
Local time
Tomorrow, 08:57
Joined
Oct 30, 2008
Messages
1,257
No, but I will if that's the only way.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 13:57
Joined
Oct 29, 2018
Messages
21,454
It's the only one I could think of right now.

Have you tried enclosing the list items in quotes?
 

kirkm

Registered User.
Local time
Tomorrow, 08:57
Joined
Oct 30, 2008
Messages
1,257
No, I read it didn't work. Are you suggesting it will ?
The table method does though, just seeing now if leading spaces appear or not.
 

moke123

AWF VIP
Local time
Today, 16:57
Joined
Jan 11, 2013
Messages
3,912
Like this?
lbox.jpg


Code:
Me.List0.AddItem """aaa;bbb"""
Me.List0.AddItem """LLL,OOO"""
 

kirkm

Registered User.
Local time
Tomorrow, 08:57
Joined
Oct 30, 2008
Messages
1,257
Are the multiple quotes using .AddItem better that using a table? Or doesn't really matter ?
 

theDBguy

I’m here to help
Staff member
Local time
Today, 13:57
Joined
Oct 29, 2018
Messages
21,454
Are the multiple quotes using .AddItem better that using a table? Or doesn't really matter ?
It may depend on how many items you plan on having in your list. I am not sure if there is a limit for adding items using the AddItem method. If there is and you need more, then I guess you'll have to use a query instead. Otherwise, the only other thing I could think of is it is probably faster to use a query/table over AddItem if you have to add so much items.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 16:57
Joined
Feb 19, 2002
Messages
43,233
Having values that include comas or semi-colons is pretty unusual. So, if the list will EVER need to be modified, just go with the table from the beginning. You can even make a form to manage the entries if you want your user to be able to add new items. Do not allow deletes though. OR if you have a number of lists, you might find my table management app useful.
 

Attachments

  • TableMaintExampleWithSecurity20210812.zip
    448.3 KB · Views: 110
  • Code Table Maintenance20210901PPT.zip
    182.8 KB · Views: 110

kirkm

Registered User.
Local time
Tomorrow, 08:57
Joined
Oct 30, 2008
Messages
1,257
Thank you Pat. I did go with the tables as it also would then allow leading spaces.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 16:57
Joined
Feb 19, 2002
Messages
43,233
Those are seriously bad codes but whatever floats your boat.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 16:57
Joined
Feb 19, 2002
Messages
43,233
Not code, codes. Code is the procedures we write to make the computer do something. The word is both singular and plural. Codes is a set of values like zip codes or area codes or department codes or gender codes, or whatever codes you are trying to use in a pick list. Codes that start with spaces or contain special characters are unusual to put it kindly.
 

kirkm

Registered User.
Local time
Tomorrow, 08:57
Joined
Oct 30, 2008
Messages
1,257
Hah I thought I was being insulted! So I was keen to see what was so bad... as for a space or punctuation in a list box, sure it may be unusual but it's what I have got. Actually the spaces are indents for rows that are not "significant" (for lack of a better word).
Most probably the list box isn't the right control, but I have to use what I know. Not that know very much! But I do know what the end result needs to be and do.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 16:57
Joined
Feb 19, 2002
Messages
43,233
I wasn't insulting you earlier. In theory, you would have no control over the codes used by the application. The user would tell you what they are. However, you do have control and you seem to have your spreadsheet hat on. There are no meaningless or grouping rows in a table in a relational database. In a table, every row is equal to every other row. They are not dependent on each other and order is not relevant. All of those rules sem to be broken here. Something like that would only be seen in a spreadsheet or perhaps a report. If your data has a hierarchy, either you need something like a tree view or multiple controls such as cascading combos, not just one. So, perhaps you should think about rethinking the design.
 

Users who are viewing this thread

Top Bottom