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_n ame"
' Create data adapter object
Dim daEmployee As OleDbDataAdapte r = New OleDbDataAdapte r(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.Tabl es("Employee"). DefaultView
ComboBox5.DataS ource = dvEmployee
ComboBox5.Displ ayMember = "employee_first _name"
Thanks in Advance!!
Elena 4 11787
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_n ame" ' Create data adapter object Dim daEmployee As OleDbDataAdapte r = New OleDbDataAdapte r(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.Tabl es("Employee"). DefaultView ComboBox5.DataS ource = dvEmployee ComboBox5.Displ ayMember = "employee_first _name"
Thanks in Advance!! Elena
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_n ame" ' Create data adapter object Dim daEmployee As OleDbDataAdapte r = New OleDbDataAdapte r(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.Tabl es("Employee"). DefaultView ComboBox5.DataS ource = dvEmployee ComboBox5.Displ ayMember = "employee_first _name"
Thanks in Advance!! Elena
He meant do something like this:
Select Employee_Last_N ame + ', ' + Employee_First_ Name AS Employee_Full_N ame
FROM Employees ORDER BY Employee_Last_N ame
....and then use Employee_Full_N ame as your display member.
"Elena" <El***@discussi ons.microsoft.c om> wrote in message
news:AD******** *************** ***********@mic rosoft.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_n ame" > ' Create data adapter object > Dim daEmployee As OleDbDataAdapte r = New > OleDbDataAdapte r(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.Tabl es("Employee"). DefaultView > ComboBox5.DataS ource = dvEmployee > ComboBox5.Displ ayMember = "employee_first _name" > >Thanks in Advance!! >Elena > >
PERFECT!! thank you :)
"James" wrote: He meant do something like this:
Select Employee_Last_N ame + ', ' + Employee_First_ Name AS Employee_Full_N ame FROM Employees ORDER BY Employee_Last_N ame
....and then use Employee_Full_N ame as your display member.
"Elena" <El***@discussi ons.microsoft.c om> wrote in message news:AD******** *************** ***********@mic rosoft.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_n ame" > ' Create data adapter object > Dim daEmployee As OleDbDataAdapte r = New > OleDbDataAdapte r(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.Tabl es("Employee"). DefaultView > ComboBox5.DataS ource = dvEmployee > ComboBox5.Displ ayMember = "employee_first _name" > >Thanks in Advance!! >Elena > > This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 I make NULL + "Text" = "Text" and treat NULL as empty string or ""?
|
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: +" "++" "+
it will only concatenate the fields if all fields have a value, which is not
what I want.
If this problem was solved I guess I would face another problem being that
there will be 2 spaces in a row between the Letter value and Surname value...
|
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 into both fields 1 and 2.
Here's the problem: It is possible that field1 may be blank (or may be
made empty by the user). In this case, tabbing out of field1 (after
emptying it, for example) also empties field3. Now tabbing out of
|
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 getting one line of the long field. Before concatenation i was getting the whole thing.
This is what I want it to look like:
Clerical: Typed reports for five people in the field, made phone calls for the new hire, arranged a cubicle for the temp...
|
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 populated are lsited below but must be recorded to a new table. Gets info from Course occurance Table.
Combo Box - Gets Information from Course Occurance Table. This table has all information regarding course information.
Course ID:
Course...
| |
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 rectify this I have created IIf statements to check if certain fields are Null and remove those fields from the concatenation. The problem I am having is how to check if multiple fields are Null. I think I need to use AND in my code, but cannot...
|
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 Concat(strGroup As String, _
strItem As String) As String
Static strLastGroup As String
Static strItems As String
|
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 every Contact / Type combination.
tblContacts: ContactID, NmFirst, NmLast. etc...
tlnkContactTypes: ContactID, ContactType (which is selected from value list)
For a summary query I need to Show all of the Contact Types for a contact...
|
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 can contain other forms, sometimes known as subsubforms. This article deals only with main forms and their immediate subforms.
The books about Access I’ve read contain some useful information about subforms, but don’t adequately cover the matter of...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |