473,395 Members | 1,495 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,395 software developers and data experts.

Combo Box Help

Hoping someone can help me. I have 3 combo boxes on a form (cbobenefit1, cbobenefit2, cbobenefit3) each populated from the same field in a table. Initially only one combobox is diplayed in the form, when this is updated a second combobox appears with the same list to choose a second benefit and then a third. I have this working using the following code in the after update event of each of the comboboxes:

Private Sub benefit1_AfterUpdate()

Form_NewPack!benefit2.Visible = True
Form_NewPack!Label56.Visible = True
Form_NewPack.Requery

End Sub

Now my problem starts. I would like to concantenate each text string selected in the comboboxes with commas to separate the choices and store them in a field in a table ( tblcustomer.[benefit]). Can anyone point me in the right direction to do this. I thought about writing the values to a text box and then to the table but not sure how to go about it.

Many thanks
Nov 27 '08 #1
3 1087
missinglinq
3,532 Expert 2GB
You only need one combobox to accomplish this this. Then write the values to a textbox that is bound to the field in your underlying table:
Expand|Select|Wrap|Line Numbers
  1. Private Sub YourComboBox_AfterUpdate()
  2.   If IsNull(Me.TextBox) Then
  3.     Me.TextBox = Me.YourComboBox
  4.   Else
  5.     Me.TextBox = Me.TextBox & ", " & Me.YourComboBox
  6.   End If
  7.  End Sub
replacing the names TextBox and YourCombobox with your actual names.

You could use a multi-select ListBox, with different code to do this, but a ListBox does take up a great deal more space on a form. Also, it generally is not a good idea to hold more than one piece of data in a given field, but that's really up to you. As in most rules, there are valid exceptions.

Welcome to Bytes!

Linq ;0)>
Nov 27 '08 #2
Thanks Missinglinq,


Worked a treat, made a couple of little changes as my customer wanted 3 pop up combos that apear as needed, but this one was driving me mad, you know what its like when yoou can't see for looking!

Thanks again
Nov 28 '08 #3
missinglinq
3,532 Expert 2GB
Glad we could help!

Linq ;0)>
Nov 28 '08 #4

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

Similar topics

2
by: SoftWhiteDelgiht | last post by:
Help me. I am obviously stupid! :-) I am just starting out with VB.Net and am trying to do a simple master/detail form with a SqlServer backend. I have created a combo box which is to populate with...
3
by: hmiller | last post by:
Hey everyone, I am having a hell of a time trying to set this menu system up. Here's what I'm trying to do. Combo Box One; is populated by names under properties "row source" "Phase 1"...
9
by: Edwinah63 | last post by:
Hi everyone, Please let there be someone out there who can help. I have two BOUND combo boxes on a continuous form, the second being dependent on the first. I have no problem getting the...
5
by: jjyconsulting | last post by:
Newbie needing some help. I have a tblParticipants. The fields include gender, education_level, income, occupation etc., I'm trying to create a form where a user can run a query from the form and...
7
by: Ausclad | last post by:
Ok, ill try again..... It seems fairly simple. I have two combo boxes in a datagrid. The datagrid is bound to a a table in a dataset. The two combo boxes are bound to a single data table...
3
by: sparks | last post by:
I have a combo box that when you go to the next combo box it is filtered based on the value in the previous one. so if combo box 1 has fred as its value then combo box 2 has 1 2 3 for values....
2
by: jafarsibtain | last post by:
hi.. I am creating a form where there are two combo Boxes (drop Down) > Program_Combo_box > Course_Code_Combo in the Program Combo Box there are five items in the list > 1. BIT 2.BCA 3....
2
by: Sid | last post by:
I need some help in setting up Access combo box. I am using three comboboxes in my form. Comb Box 1, Combo Box 2, Combo Box 3. The row source for each of the combo box is a seperate table. ...
4
by: Dave | last post by:
I wasn't sure how to search for previous posts about this, it felt real specific. Ok so here's the database & problem: I have 4 combo boxes: cboServer, cboPolicy, cboDB, and cboApplication. ...
6
by: =?Utf-8?B?amVmZmVyeQ==?= | last post by:
i need help with a combo box and this same code works on my first tab with a combo box. The error or problem i have is this code causes an index out of range error when i run it on my second combo...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...

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.