By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,490 Members | 1,417 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,490 IT Pros & Developers. It's quick & easy.

How to accumulate text in a combobox?

P: n/a
Hi,

Each time the user selects an item from a combobox, I want that string to
get appended to the values that were already selected. The result is that
the combo is accumulating text each time the user selects an item from its
list. I want the delete and backspace keys to function normally, as well
as all the other properties of the combobox.

Does anybody know the easiest way to do this?

Thanks!
Norm
Nov 13 '05 #1
Share this Question
Share on Google+
14 Replies


P: n/a
On Sun, 19 Sep 2004 16:22:11 -0500, Norm wrote:
Hi,

Each time the user selects an item from a combobox, I want that string to
get appended to the values that were already selected. The result is that
the combo is accumulating text each time the user selects an item from its
list. I want the delete and backspace keys to function normally, as well
as all the other properties of the combobox.

Does anybody know the easiest way to do this?

Thanks!
Norm


Code the Combo Box AfterUpdate event:
[ControlName] = [ControlName] & Me![ComboName]
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
Nov 13 '05 #2

P: n/a
fredg <fg******@example.invalid> wrote in
news:1f****************************@40tude.net:
On Sun, 19 Sep 2004 16:22:11 -0500, Norm wrote:
Hi,

Each time the user selects an item from a combobox, I want that
string to get appended to the values that were already selected. The
result is that the combo is accumulating text each time the user
selects an item from its list. I want the delete and backspace keys
to function normally, as well as all the other properties of the
combobox.

Does anybody know the easiest way to do this?

Thanks!
Norm


Code the Combo Box AfterUpdate event:
[ControlName] = [ControlName] & Me![ComboName]


Hi Fred,

Thanks for the reply, but that's not quite right. [ControlName] and Me!
[ComboName] both contain the new value selected by the user. The result
is that the old value gets lost and the combo becomes equal to the new
value string & the new value string.

Norm
Nov 13 '05 #3

P: n/a
On Sun, 19 Sep 2004 17:26:05 -0500, Norm wrote:
fredg <fg******@example.invalid> wrote in
news:1f****************************@40tude.net:
On Sun, 19 Sep 2004 16:22:11 -0500, Norm wrote:
Hi,

Each time the user selects an item from a combobox, I want that
string to get appended to the values that were already selected. The
result is that the combo is accumulating text each time the user
selects an item from its list. I want the delete and backspace keys
to function normally, as well as all the other properties of the
combobox.

Does anybody know the easiest way to do this?

Thanks!
Norm


Code the Combo Box AfterUpdate event:
[ControlName] = [ControlName] & Me![ComboName]


Hi Fred,

Thanks for the reply, but that's not quite right. [ControlName] and Me!
[ComboName] both contain the new value selected by the user. The result
is that the old value gets lost and the combo becomes equal to the new
value string & the new value string.

Norm


You are not correct in your statement.

Perhaps you should try it first, or perhaps you tried it but you did
not write the expression properly.
[ControlName] = [ControlName] & Me![ComboName]
If you select 3 items, one at a time, from a combo box, the result in
the text box will be the 3 items, one after the other.
Select Yes, then Maybe, then No, and the text box will read
YesMaybeNo.

If you incorrectly wrote:
[ControlName] = Me!ComboName
then you would see only the last item selected.

--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
Nov 13 '05 #4

P: n/a
fredg <fg******@example.invalid> wrote in
news:1c*****************************@40tude.net:
On Sun, 19 Sep 2004 17:26:05 -0500, Norm wrote:
fredg <fg******@example.invalid> wrote in
news:1f****************************@40tude.net:
On Sun, 19 Sep 2004 16:22:11 -0500, Norm wrote:

Hi,

Each time the user selects an item from a combobox, I want that
string to get appended to the values that were already selected.
The result is that the combo is accumulating text each time the
user selects an item from its list. I want the delete and
backspace keys to function normally, as well as all the other
properties of the combobox.

Does anybody know the easiest way to do this?

Thanks!
Norm

Code the Combo Box AfterUpdate event:
[ControlName] = [ControlName] & Me![ComboName]


Hi Fred,

Thanks for the reply, but that's not quite right. [ControlName] and
Me! [ComboName] both contain the new value selected by the user. The
result is that the old value gets lost and the combo becomes equal to
the new value string & the new value string.

Norm


You are not correct in your statement.

Perhaps you should try it first, or perhaps you tried it but you did
not write the expression properly.
[ControlName] = [ControlName] & Me![ComboName]
If you select 3 items, one at a time, from a combo box, the result in
the text box will be the 3 items, one after the other.
Select Yes, then Maybe, then No, and the text box will read
YesMaybeNo.

If you incorrectly wrote:
[ControlName] = Me!ComboName
then you would see only the last item selected.


Thanks again for your reply.

I think the problem is that I didn't fully explain what I'm trying to
do. I want to update the selected text in the combo with the
accumulated values. So...[ControlName] = [ComboName]. Using your
expression, it would be [ComboName] = [ComboName] & Me![ComboName].

I did try your expression and I'm not getting the correct result.

Any other ideas?

Norm
Nov 13 '05 #5

P: n/a
On Sun, 19 Sep 2004 20:45:10 -0500, Norm wrote:
fredg <fg******@example.invalid> wrote in
news:1c*****************************@40tude.net:
On Sun, 19 Sep 2004 17:26:05 -0500, Norm wrote:
fredg <fg******@example.invalid> wrote in
news:1f****************************@40tude.net:

On Sun, 19 Sep 2004 16:22:11 -0500, Norm wrote:

> Hi,
>
> Each time the user selects an item from a combobox, I want that
> string to get appended to the values that were already selected.
> The result is that the combo is accumulating text each time the
> user selects an item from its list. I want the delete and
> backspace keys to function normally, as well as all the other
> properties of the combobox.
>
> Does anybody know the easiest way to do this?
>
> Thanks!
> Norm

Code the Combo Box AfterUpdate event:
[ControlName] = [ControlName] & Me![ComboName]

Hi Fred,

Thanks for the reply, but that's not quite right. [ControlName] and
Me! [ComboName] both contain the new value selected by the user. The
result is that the old value gets lost and the combo becomes equal to
the new value string & the new value string.

Norm


You are not correct in your statement.

Perhaps you should try it first, or perhaps you tried it but you did
not write the expression properly.
[ControlName] = [ControlName] & Me![ComboName]
If you select 3 items, one at a time, from a combo box, the result in
the text box will be the 3 items, one after the other.
Select Yes, then Maybe, then No, and the text box will read
YesMaybeNo.

If you incorrectly wrote:
[ControlName] = Me!ComboName
then you would see only the last item selected.


Thanks again for your reply.

I think the problem is that I didn't fully explain what I'm trying to
do. I want to update the selected text in the combo with the
accumulated values. So...[ControlName] = [ComboName]. Using your
expression, it would be [ComboName] = [ComboName] & Me![ComboName].

I did try your expression and I'm not getting the correct result.

Any other ideas?

Norm


You're correct. I did misread your request, and thought you wanted to
add text to a control,(a common procedure) based upon selections in
the combo box.

It seems like a rather strange request and makes no sense to me.
You already have a at least one value in the combo (let's say "Joe)
that you select, and you want to change the value in the combo to
"JoeJoe"?
And then what? "JoeJoeJoeJoe".
The usual purpose of a combo is to select a value and insert into a
control or field not into itself.

--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
Nov 13 '05 #6

P: n/a
fredg <fg******@example.invalid> wrote in
news:16*****************************@40tude.net:
On Sun, 19 Sep 2004 20:45:10 -0500, Norm wrote:
fredg <fg******@example.invalid> wrote in
news:1c*****************************@40tude.net:
On Sun, 19 Sep 2004 17:26:05 -0500, Norm wrote:

fredg <fg******@example.invalid> wrote in
news:1f****************************@40tude.net:

> On Sun, 19 Sep 2004 16:22:11 -0500, Norm wrote:
>
>> Hi,
>>
>> Each time the user selects an item from a combobox, I want that
>> string to get appended to the values that were already selected.
>> The result is that the combo is accumulating text each time the
>> user selects an item from its list. I want the delete and
>> backspace keys to function normally, as well as all the other
>> properties of the combobox.
>>
>> Does anybody know the easiest way to do this?
>>
>> Thanks!
>> Norm
>
> Code the Combo Box AfterUpdate event:
> [ControlName] = [ControlName] & Me![ComboName]

Hi Fred,

Thanks for the reply, but that's not quite right. [ControlName]
and Me! [ComboName] both contain the new value selected by the
user. The result is that the old value gets lost and the combo
becomes equal to the new value string & the new value string.

Norm

You are not correct in your statement.

Perhaps you should try it first, or perhaps you tried it but you did
not write the expression properly.
[ControlName] = [ControlName] & Me![ComboName]
If you select 3 items, one at a time, from a combo box, the result
in the text box will be the 3 items, one after the other.
Select Yes, then Maybe, then No, and the text box will read
YesMaybeNo.

If you incorrectly wrote:
[ControlName] = Me!ComboName
then you would see only the last item selected.


Thanks again for your reply.

I think the problem is that I didn't fully explain what I'm trying to
do. I want to update the selected text in the combo with the
accumulated values. So...[ControlName] = [ComboName]. Using your
expression, it would be [ComboName] = [ComboName] & Me![ComboName].

I did try your expression and I'm not getting the correct result.

Any other ideas?

Norm


You're correct. I did misread your request, and thought you wanted to
add text to a control,(a common procedure) based upon selections in
the combo box.

It seems like a rather strange request and makes no sense to me.
You already have a at least one value in the combo (let's say "Joe)
that you select, and you want to change the value in the combo to
"JoeJoe"?
And then what? "JoeJoeJoeJoe".
The usual purpose of a combo is to select a value and insert into a
control or field not into itself.


Yes, that is exactly what I want to do. The reason is that the user is
selecting multiple items from the combo, and all of their selections
need to be captured in this string. I don't have the space to use
checkboxes or radio buttons to select these items, and have many combos
on the form. By selecting multiple items in the combo and concatenating
them into one string, the user can assemble whatever string they desire
into the combo. Unfortunately, I believe this is really the way I need
to do it.

Any ideas on how?

Norm
Nov 13 '05 #7

P: n/a
Norm <od*****@comcast.net> wrote in
news:Xn******************************@216.196.97.1 36:
fredg <fg******@example.invalid> wrote in
news:16*****************************@40tude.net:
On Sun, 19 Sep 2004 20:45:10 -0500, Norm wrote:
fredg <fg******@example.invalid> wrote in
news:1c*****************************@40tude.net:

On Sun, 19 Sep 2004 17:26:05 -0500, Norm wrote:

> fredg <fg******@example.invalid> wrote in
> news:1f****************************@40tude.net:
>
>> On Sun, 19 Sep 2004 16:22:11 -0500, Norm wrote:
>>
>>> Hi,
>>>
>>> Each time the user selects an item from a combobox, I want that
>>> string to get appended to the values that were already selected.
>>> The result is that the combo is accumulating text each time the
>>> user selects an item from its list. I want the delete and
>>> backspace keys to function normally, as well as all the other
>>> properties of the combobox.
>>>
>>> Does anybody know the easiest way to do this?
>>>
>>> Thanks!
>>> Norm
>>
>> Code the Combo Box AfterUpdate event:
>> [ControlName] = [ControlName] & Me![ComboName]
>
> Hi Fred,
>
> Thanks for the reply, but that's not quite right. [ControlName]
> and Me! [ComboName] both contain the new value selected by the
> user. The result is that the old value gets lost and the combo
> becomes equal to the new value string & the new value string.
>
> Norm

You are not correct in your statement.

Perhaps you should try it first, or perhaps you tried it but you
did not write the expression properly.
[ControlName] = [ControlName] & Me![ComboName]
If you select 3 items, one at a time, from a combo box, the result
in the text box will be the 3 items, one after the other.
Select Yes, then Maybe, then No, and the text box will read
YesMaybeNo.

If you incorrectly wrote:
[ControlName] = Me!ComboName
then you would see only the last item selected.
Thanks again for your reply.

I think the problem is that I didn't fully explain what I'm trying
to do. I want to update the selected text in the combo with the
accumulated values. So...[ControlName] = [ComboName]. Using your
expression, it would be [ComboName] = [ComboName] & Me![ComboName].

I did try your expression and I'm not getting the correct result.

Any other ideas?

Norm


You're correct. I did misread your request, and thought you wanted to
add text to a control,(a common procedure) based upon selections in
the combo box.

It seems like a rather strange request and makes no sense to me.
You already have a at least one value in the combo (let's say "Joe)
that you select, and you want to change the value in the combo to
"JoeJoe"?
And then what? "JoeJoeJoeJoe".
The usual purpose of a combo is to select a value and insert into a
control or field not into itself.


Yes, that is exactly what I want to do. The reason is that the user
is selecting multiple items from the combo, and all of their
selections need to be captured in this string. I don't have the space
to use checkboxes or radio buttons to select these items, and have
many combos on the form. By selecting multiple items in the combo and
concatenating them into one string, the user can assemble whatever
string they desire into the combo. Unfortunately, I believe this is
really the way I need to do it.

Any ideas on how?

Norm


Fred,

Based on your original suggestion to me, I think I solved the problem.
Thanks for taking the time to reply which enabled me to discover the
solution! Norm
Nov 13 '05 #8

P: n/a
Wes
Try this on the after update.

Me.YourField = Me.YourField & Me.ComboBox
Norm <od*****@comcast.net> wrote in message news:<Xn*******************************@216.196.97 .136>...
Norm <od*****@comcast.net> wrote in
news:Xn******************************@216.196.97.1 36:
fredg <fg******@example.invalid> wrote in
news:16*****************************@40tude.net:
On Sun, 19 Sep 2004 20:45:10 -0500, Norm wrote:

fredg <fg******@example.invalid> wrote in
news:1c*****************************@40tude.net:

> On Sun, 19 Sep 2004 17:26:05 -0500, Norm wrote:
>
>> fredg <fg******@example.invalid> wrote in
>> news:1f****************************@40tude.net:
>>
>>> On Sun, 19 Sep 2004 16:22:11 -0500, Norm wrote:
>>>
>>>> Hi,
>>>>
>>>> Each time the user selects an item from a combobox, I want that
>>>> string to get appended to the values that were already selected.
>>>> The result is that the combo is accumulating text each time the
>>>> user selects an item from its list. I want the delete and
>>>> backspace keys to function normally, as well as all the other
>>>> properties of the combobox.
>>>>
>>>> Does anybody know the easiest way to do this?
>>>>
>>>> Thanks!
>>>> Norm
>>>
>>> Code the Combo Box AfterUpdate event:
>>> [ControlName] = [ControlName] & Me![ComboName]
>>
>> Hi Fred,
>>
>> Thanks for the reply, but that's not quite right. [ControlName]
>> and Me! [ComboName] both contain the new value selected by the
>> user. The result is that the old value gets lost and the combo
>> becomes equal to the new value string & the new value string.
>>
>> Norm
>
> You are not correct in your statement.
>
> Perhaps you should try it first, or perhaps you tried it but you
> did not write the expression properly.
> [ControlName] = [ControlName] & Me![ComboName]
> If you select 3 items, one at a time, from a combo box, the result
> in the text box will be the 3 items, one after the other.
> Select Yes, then Maybe, then No, and the text box will read
> YesMaybeNo.
>
> If you incorrectly wrote:
> [ControlName] = Me!ComboName
> then you would see only the last item selected.
>

Thanks again for your reply.

I think the problem is that I didn't fully explain what I'm trying
to do. I want to update the selected text in the combo with the
accumulated values. So...[ControlName] = [ComboName]. Using your
expression, it would be [ComboName] = [ComboName] & Me![ComboName].

I did try your expression and I'm not getting the correct result.

Any other ideas?

Norm

You're correct. I did misread your request, and thought you wanted to
add text to a control,(a common procedure) based upon selections in
the combo box.

It seems like a rather strange request and makes no sense to me.
You already have a at least one value in the combo (let's say "Joe)
that you select, and you want to change the value in the combo to
"JoeJoe"?
And then what? "JoeJoeJoeJoe".
The usual purpose of a combo is to select a value and insert into a
control or field not into itself.


Yes, that is exactly what I want to do. The reason is that the user
is selecting multiple items from the combo, and all of their
selections need to be captured in this string. I don't have the space
to use checkboxes or radio buttons to select these items, and have
many combos on the form. By selecting multiple items in the combo and
concatenating them into one string, the user can assemble whatever
string they desire into the combo. Unfortunately, I believe this is
really the way I need to do it.

Any ideas on how?

Norm


Fred,

Based on your original suggestion to me, I think I solved the problem.
Thanks for taking the time to reply which enabled me to discover the
solution! Norm

Nov 13 '05 #9

P: n/a
sl****@sbcglobal.net (Wes) wrote in
news:3e**************************@posting.google.c om:
Try this on the after update.

Me.YourField = Me.YourField & Me.ComboBox


Since I am updating the combo itself, your expression would become:

Me.ComboBox = Me.ComboBox & Me.ComboBox

Am I understanding you correctly? That expression would not produce the
correct result.

Norm
Nov 13 '05 #10

P: n/a

"Norm" <od*****@comcast.net> wrote in message
news:Xn*******************************@216.196.97. 136...
sl****@sbcglobal.net (Wes) wrote in
news:3e**************************@posting.google.c om:
Try this on the after update.

Me.YourField = Me.YourField & Me.ComboBox


Since I am updating the combo itself, your expression would become:

Me.ComboBox = Me.ComboBox & Me.ComboBox

Am I understanding you correctly? That expression would not produce the
correct result.


I fairly sure you'll have to use a separate control to accumulate the results.
--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Nov 13 '05 #11

P: n/a
Why not save yourself a whole lot of hassle and just use a
multi-select listbox? Comboboxes really are not built to do what you
want. MSLB's are.
Nov 13 '05 #12

P: n/a
Have you tried

comboBox1.Text&=comboBox1.SelectedItem.ToString()

?
with regards,
J.V.Ravichandran
- http://www.geocities.com/
jvravichandran
- http://www.411asp.net/func/search?
qry=Ravichandran+J.V.&cob=aspnetpro
- http://www.southasianoutlook.com
- http://www.MSDNAA.Net
- http://www.csharphelp.com
- http://www.poetry.com/Publications/
display.asp?ID=P3966388&BN=999&PN=2
- Or, just search on "J.V.Ravichandran"
at http://www.Google.com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #13

P: n/a
pi********@hotmail.com (Pieter Linden) wrote in
news:bf**************************@posting.google.c om:
Why not save yourself a whole lot of hassle and just use a
multi-select listbox? Comboboxes really are not built to do what you
want. MSLB's are.


Great suggestion, however I have specific requirements which make the MSLB
not ideal. Each Combo/Listbox (there are over a dozen on each form) can
only be 2 characters in height to fit them all on the page and obviously
have a limited width. Scrolling through a listbox of 2 character height
only enables the user to see 1 item per line. It's much nicer with the
combo when they drop it down they can see all the choices but the control
still only takes up 2 lines in height.

Given the short height of the box, the look and feel is just better with a
Combo. Thanks for the idea though.

Norm
Nov 13 '05 #14

P: n/a
Ravichandran J.V. <jv************@yahoo.com> wrote in news:414ff977$0$26101
$c******@news.newsgroups.ws:
Have you tried

comboBox1.Text&=comboBox1.SelectedItem.ToString()

?
with regards,
J.V.Ravichandran
- http://www.geocities.com/
jvravichandran


I tried that expression but there were multiple errors and it didn't
execute. Thanks for the try.

Norm
Nov 13 '05 #15

This discussion thread is closed

Replies have been disabled for this discussion.