473,320 Members | 2,112 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,320 software developers and data experts.

concatenating fields in a combo box.

Hi,

I am filling in a combobox. I would like to concatenate two fields into the
data combo box and display "last name, first name"

I tried to displaymember = "employee_last_name" & ", " &
"employee_last_name", but it did not like that.

I can fill the combo box with either the first or the last, but I cannot
manage to concatenate it.

Any suggestions? My code is below.

'fill employee combo box.
strsql = "SELECT * FROM Employee order by employee_last_name"
' Create data adapter object
Dim daEmployee As OleDbDataAdapter = New OleDbDataAdapter(strsql,
TSA.conn)
' Create a dataset object and fill with data using data adapter's
Fill method
Dim dsEmployee As DataSet = New DataSet
daEmployee.Fill(dsEmployee, "Employee")
' Attach dataset's DefaultView to the datagrid control
Dim dvEmployee As DataView = dsEmployee.Tables("Employee").DefaultView
ComboBox5.DataSource = dvEmployee
ComboBox5.DisplayMember = "employee_first_name"

Thanks in Advance!!
Elena
Nov 21 '05 #1
4 11748
Try concatenating the names in the query with an assigned column name,
and list the specific columns you want instead of using *, which pulls
every column.

Tom

Elena wrote:
Hi,

I am filling in a combobox. I would like to concatenate two fields into the
data combo box and display "last name, first name"

I tried to displaymember = "employee_last_name" & ", " &
"employee_last_name", but it did not like that.

I can fill the combo box with either the first or the last, but I cannot
manage to concatenate it.

Any suggestions? My code is below.

'fill employee combo box.
strsql = "SELECT * FROM Employee order by employee_last_name"
' Create data adapter object
Dim daEmployee As OleDbDataAdapter = New OleDbDataAdapter(strsql,
TSA.conn)
' Create a dataset object and fill with data using data adapter's
Fill method
Dim dsEmployee As DataSet = New DataSet
daEmployee.Fill(dsEmployee, "Employee")
' Attach dataset's DefaultView to the datagrid control
Dim dvEmployee As DataView = dsEmployee.Tables("Employee").DefaultView
ComboBox5.DataSource = dvEmployee
ComboBox5.DisplayMember = "employee_first_name"

Thanks in Advance!!
Elena

Nov 21 '05 #2
How would I then change the .displaymember? It does not read the data view,
nor can I pull concatenated fields.

Thanks,
Elena

"tomb" wrote:
Try concatenating the names in the query with an assigned column name,
and list the specific columns you want instead of using *, which pulls
every column.

Tom

Elena wrote:
Hi,

I am filling in a combobox. I would like to concatenate two fields into the
data combo box and display "last name, first name"

I tried to displaymember = "employee_last_name" & ", " &
"employee_last_name", but it did not like that.

I can fill the combo box with either the first or the last, but I cannot
manage to concatenate it.

Any suggestions? My code is below.

'fill employee combo box.
strsql = "SELECT * FROM Employee order by employee_last_name"
' Create data adapter object
Dim daEmployee As OleDbDataAdapter = New OleDbDataAdapter(strsql,
TSA.conn)
' Create a dataset object and fill with data using data adapter's
Fill method
Dim dsEmployee As DataSet = New DataSet
daEmployee.Fill(dsEmployee, "Employee")
' Attach dataset's DefaultView to the datagrid control
Dim dvEmployee As DataView = dsEmployee.Tables("Employee").DefaultView
ComboBox5.DataSource = dvEmployee
ComboBox5.DisplayMember = "employee_first_name"

Thanks in Advance!!
Elena

Nov 21 '05 #3
He meant do something like this:

Select Employee_Last_Name + ', ' + Employee_First_Name AS Employee_Full_Name
FROM Employees ORDER BY Employee_Last_Name

....and then use Employee_Full_Name as your display member.

"Elena" <El***@discussions.microsoft.com> wrote in message
news:AD**********************************@microsof t.com...
How would I then change the .displaymember? It does not read the data
view,
nor can I pull concatenated fields.

Thanks,
Elena

"tomb" wrote:
Try concatenating the names in the query with an assigned column name,
and list the specific columns you want instead of using *, which pulls
every column.

Tom

Elena wrote:
>Hi,
>
>I am filling in a combobox. I would like to concatenate two fields into
>the
>data combo box and display "last name, first name"
>
>I tried to displaymember = "employee_last_name" & ", " &
>"employee_last_name", but it did not like that.
>
>I can fill the combo box with either the first or the last, but I cannot
>manage to concatenate it.
>
>Any suggestions? My code is below.
>
> 'fill employee combo box.
> strsql = "SELECT * FROM Employee order by employee_last_name"
> ' Create data adapter object
> Dim daEmployee As OleDbDataAdapter = New
> OleDbDataAdapter(strsql,
>TSA.conn)
> ' Create a dataset object and fill with data using data
> adapter's
>Fill method
> Dim dsEmployee As DataSet = New DataSet
> daEmployee.Fill(dsEmployee, "Employee")
> ' Attach dataset's DefaultView to the datagrid control
> Dim dvEmployee As DataView =
> dsEmployee.Tables("Employee").DefaultView
> ComboBox5.DataSource = dvEmployee
> ComboBox5.DisplayMember = "employee_first_name"
>
>Thanks in Advance!!
>Elena
>
>

Nov 21 '05 #4
PERFECT!! thank you :)

"James" wrote:
He meant do something like this:

Select Employee_Last_Name + ', ' + Employee_First_Name AS Employee_Full_Name
FROM Employees ORDER BY Employee_Last_Name

....and then use Employee_Full_Name as your display member.

"Elena" <El***@discussions.microsoft.com> wrote in message
news:AD**********************************@microsof t.com...
How would I then change the .displaymember? It does not read the data
view,
nor can I pull concatenated fields.

Thanks,
Elena

"tomb" wrote:
Try concatenating the names in the query with an assigned column name,
and list the specific columns you want instead of using *, which pulls
every column.

Tom

Elena wrote:

>Hi,
>
>I am filling in a combobox. I would like to concatenate two fields into
>the
>data combo box and display "last name, first name"
>
>I tried to displaymember = "employee_last_name" & ", " &
>"employee_last_name", but it did not like that.
>
>I can fill the combo box with either the first or the last, but I cannot
>manage to concatenate it.
>
>Any suggestions? My code is below.
>
> 'fill employee combo box.
> strsql = "SELECT * FROM Employee order by employee_last_name"
> ' Create data adapter object
> Dim daEmployee As OleDbDataAdapter = New
> OleDbDataAdapter(strsql,
>TSA.conn)
> ' Create a dataset object and fill with data using data
> adapter's
>Fill method
> Dim dsEmployee As DataSet = New DataSet
> daEmployee.Fill(dsEmployee, "Employee")
> ' Attach dataset's DefaultView to the datagrid control
> Dim dvEmployee As DataView =
> dsEmployee.Tables("Employee").DefaultView
> ComboBox5.DataSource = dvEmployee
> ComboBox5.DisplayMember = "employee_first_name"
>
>Thanks in Advance!!
>Elena
>
>


Nov 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Craig | last post by:
I am connecting to an Access DB using ODBC. In my SQL statement I have Field1 + ' ' + Field2 and a field is NULL it returns NULL 1 field may contain NULLs So NULL + "Text" = NULL How can...
5
by: john | last post by:
In a query I have the fields Letter, Prefix, and Surname. I need to make a report in which there is one field called Name which is a concatenation of the three fields. When I do this: Expr2: +"...
2
by: exapplerep | last post by:
I've seen how to use VBA code to concatenate two fields into a third by using an expression in the "After Update" property in fields 1 & 2. field3 = field1 + field2 The above code would go...
5
by: JRNewKid | last post by:
I want to concatenate two fields on a report. They are two text fields, wrkDescription is 10 characters long and wrkTextDescription is 255. I have them concatenated in the report but I'm only...
6
by: zuchowra | last post by:
Hi everyone. I need help. I have a combo box in my form that i want to populate multiple text boxes after you select your selection in the combo box. Here is my set up. The Fields that need to be...
8
by: banderson | last post by:
Hello, I have a combo box in which I want to display multiple fields by concatenating the fields together. If one of those concatenated fields is Null, then the combo box does not show anything. To...
2
by: Whizzo | last post by:
Hi all; I'm using this great bit of code to concatenate a fields from multiple rows into a single one. 'Concat Returns lists of items which are within a grouped field Public Function...
3
by: banderson | last post by:
Hello all, I have a table "tblContacts" that holds my Contact Info. Because there can be multiple Contact Types for a Contact, I have a second table "tlnkContactTypes" in which there is a record for...
0
by: Gordon Padwick | last post by:
A form contains controls, one or more of which can be other forms. A form that contains another form is known as a main form. A form contained by a main form is known as a subform. A subform itself...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.