Combo Box

B

Beeyen

Good Day,

I have a combo box in which, I would like to select through the dropdown an
employee name entered in a Employee table ie LastName, and FirstName. When I
click on the dropdown I see the LastName and if I scroll over the FirstName.
But when I select the name only the LastName shows.

I have a SQL query with the EmployeeID, LastName (Ascending order checkbox)
and FirstName

In the properties of the field of the combo box I have the following coded:

RowSource
SELECT [Benefits Employee].EmployeeID, [Benefits Employee].LastName,
[Benefits Employee].FirstName FROM [Benefits Employee] ORDER BY [Benefits
Employee].LastName WITH OWNERACCESS OPTION;

ColumnCount = 3

ColumnWidths = 0";1";1"

Row Source Type = Table/Query

Can someone give me a helping hand?


Thanks
 
G

Graham R Seach

Hi Beeyen,

Access will only display the first *visible* column. In your case, that's
the LastName column. Sorry, but there's no way to display any other column.
You have two options:

Firstly, you can modify your SQL statement to display the whole name:
SELECT EmployeeID, LastName & ", " & FirstName AS EmployeeName
FROM [Benefits Employee]
ORDER BY LastName
WITH OWNERACCESS OPTION

** Don't forget to change the ColumnCount and ColumnWIdths properties
accordingly.

Alternatively, you can transfer the data in the FirstName column into a
textbox which you can conveniently locate next to the combo. Do do that, add
a textbox called "txtFirstName" and site it next to the combo. Then add the
following code to the combo's AfterUpdate event:
Me!txtFirstName = Me!cboMyCombo.Column(2)

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
B

Beeyen

Outstanding!

Thanks you for the direction with a very clear and concise explanation. And
for providing the alternative as well!

Good Day

Graham R Seach said:
Hi Beeyen,

Access will only display the first *visible* column. In your case, that's
the LastName column. Sorry, but there's no way to display any other column.
You have two options:

Firstly, you can modify your SQL statement to display the whole name:
SELECT EmployeeID, LastName & ", " & FirstName AS EmployeeName
FROM [Benefits Employee]
ORDER BY LastName
WITH OWNERACCESS OPTION

** Don't forget to change the ColumnCount and ColumnWIdths properties
accordingly.

Alternatively, you can transfer the data in the FirstName column into a
textbox which you can conveniently locate next to the combo. Do do that, add
a textbox called "txtFirstName" and site it next to the combo. Then add the
following code to the combo's AfterUpdate event:
Me!txtFirstName = Me!cboMyCombo.Column(2)

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

Beeyen said:
Good Day,

I have a combo box in which, I would like to select through the dropdown
an
employee name entered in a Employee table ie LastName, and FirstName.
When I
click on the dropdown I see the LastName and if I scroll over the
FirstName.
But when I select the name only the LastName shows.

I have a SQL query with the EmployeeID, LastName (Ascending order
checkbox)
and FirstName

In the properties of the field of the combo box I have the following
coded:

RowSource
SELECT [Benefits Employee].EmployeeID, [Benefits Employee].LastName,
[Benefits Employee].FirstName FROM [Benefits Employee] ORDER BY [Benefits
Employee].LastName WITH OWNERACCESS OPTION;

ColumnCount = 3

ColumnWidths = 0";1";1"

Row Source Type = Table/Query

Can someone give me a helping hand?


Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top