473,414 Members | 1,674 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

How do I Use a ';' Within the Value of a Column in a ComboBox or ListBox

759 512MB
Here is a "solution" to edit an item in a list (the example is for a list box but should work for a combo box too)
http://bytes.com/topic/access/answer...ox#post3711826

I make some "discoveries" trying to develop that code:

Is no way to add to a list box an item like this:
I am a coder; The best one !
When I try to add this item (using .AddItem method) to a list box with only one column, only first part (I am a coder) has been added. The second part has been lost.
For a list box with many columns this item is split: first part in first column, the second part in the second column.
So is it possible to add, in a single "cell" an item that contain the ";" sign ?

Another thing:
Is no way to deselect all items.
Somewhere I read that
Expand|Select|Wrap|Line Numbers
  1. ListBox = ""
should work.
Yes. This work until... an item in the list box is "". If this happen, this "empty" item will be selected.

Of course, as a human I can use this:
Expand|Select|Wrap|Line Numbers
  1. ListBox = "ThisStringNeverWillAppeareInMyListBox"
But as coder I can't be sure that even this "crazy" string will not appear at a moment.

If you have some solution to this problems please let me know.

Thank you !
Mar 26 '12 #1

✓ answered by Hennepin

Wrap the string with ; with quotes.
Expand|Select|Wrap|Line Numbers
  1. Me.List0.AddItem """I am a coder;The best one !"""

10 3197
NeoPa
32,556 Expert Mod 16PB
If you look in the Help system (Context-Sensitive Help) you'll see that you can pass multiple values in a single string value with semi-colon (;) separators.
Mar 26 '12 #2
Mihail
759 512MB
Yes, NeoPa. I know that.
My question is how to put a string that contain semi-colons in a single "cell" in a list box ? How to avoid that this string to be split ?
Mar 26 '12 #3
NeoPa
32,556 Expert Mod 16PB
Sorry Mihail. I was confused by the question, but now I read it again it's clear that you did include that in the explanation. I read it badly.

Now, that's a good question. Help has nothing to say on the matter so I suggest you experiment with some of the typical 'string escape' characters (EG. '\'). Doubling up may be worth a try, but I'd guess that would simply result in an empty column value.
Mar 26 '12 #4
Mihail
759 512MB
No problem, Adrian. Seems that my "English" is hard to understand even for you, an English guy.

I never have heard about 'string escape' characters.
I'll search on Google, of course, but if you are so kind to explain that in a little bit more details I'll thank you (again) very much.
Mar 26 '12 #5
NeoPa
32,556 Expert Mod 16PB
Mihail:
No problem, Adrian. Seems that my "English" is hard to understand even for you, an English guy.
It's because I'm English, rather than in spite of it, Mihail ;-)

What I'm suggesting is simply to try :
Expand|Select|Wrap|Line Numbers
  1. "I am a coder\;The best one !"
Mar 27 '12 #6
Mihail
759 512MB
Thank you !
No success.
Again 2 strings: I am a coder\ and The best one !

OK. I decide to not waste more time on this subject.
Thank you again !
Mar 27 '12 #7
Wrap the string with ; with quotes.
Expand|Select|Wrap|Line Numbers
  1. Me.List0.AddItem """I am a coder;The best one !"""
Mar 27 '12 #8
NeoPa
32,556 Expert Mod 16PB
Mihail:
OK. I decide to not waste more time on this subject.
That's lucky, because I'm out of ideas anyway :-D

If I find anything I'll post but basically, as of now, I have no idea if it's even possible :-(
Mar 27 '12 #9
NeoPa
32,556 Expert Mod 16PB
Except that Hennepin has already provided a perfect answer. Nice one.
Mar 27 '12 #10
Mihail
759 512MB
Indeed. It is the best answer.

Also I have verify this:
Expand|Select|Wrap|Line Numbers
  1. Me.List0.AddItem """I am a coder;The best one FirstColumn !"";""I am a coder;The best one SecondColumn !"""
for a list box with 2 columns and work perfect.

Thank you, Hennepin !
Mar 27 '12 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: arthur-e | last post by:
How can you select records based on more than one combo box - I have a combobox that selects records based on name (I'm sure this has been asked a thousand times - web site answer/link could be...
3
by: Mike Jakes | last post by:
I hope that someone can offer a little advice on this one - I've searched the group but can't find an answer. I think that I'm doing something really stupid or missing something trivial, but see...
0
by: Tom | last post by:
I have some very strange issues with combo boxes on a tab control. Here's the scenario: I have a Windows Forms form that has a tab control on it, with two (2) tabs. Tab 2 happens to have a number...
2
by: lottaviano | last post by:
I have a form with two combo boxes. The value chosen in the first combo box (cbo1) is supposed to change the values that appear in the second combo box (cbo2). This currently works great for the...
1
by: Dave | last post by:
Hello all, First I'd like to apologize...This post was meant to be put in my previous post, but I tried many times without success to reply within my previous post. Now here goes... I have a...
2
by: Dave | last post by:
I have 3 tables of information feeding into 4 combo boxes on my main form (DR Form). I have as many list boxes (acting as text boxes) as there are fields in each one of the 3 tables. Once...
2
by: ARC | last post by:
I'm testing a user's db that contains a very large number of records. I have an invoice screen, with an invoice select dropdown box that shows all invoices, and the customer's name, etc. With...
1
by: margot | last post by:
Hello, I have a "data entry form" with several text boxes and list boxes, combo boxes.The user is suppose to select a student first name from a combo box and a last name from another combo box and...
11
by: jgoodnight | last post by:
Hi, I have a form with three combo boxes: Area, Sub-Area, and Factor. I've set up the Sub-Area combo box to list only those areas that are part of the selected area. I've set up the Factor combo...
3
by: dblack64 | last post by:
I am working in Access 2007. I have a form named Master Terms List that contains 4 bound text boxes and 7 cascading combo boxes. The bound text boxes have data sources from a table named Termslist. ...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.