Comnobox on subform question

  • Thread starter Thread starter Graham Naylor
  • Start date Start date
G

Graham Naylor

Hi.

I am writing an app where I have got a form with a subform, set as
'Continuous pages', on the subform one of the controls is a combo box. The
problem I need to get around is, the Combo box has a number of columns to
make selecting the right record easier, however when a record is selected
only rhe data from the first column is displayed.

My first idea was to put a label after the combo box and in the "After
Update" event put the data fron the 2nd column of the combo box into the
label, this worked fine except the value in the label appeared in every line
wthin the sub form rather than just in the line in question.

So how do I get the combo box to display more than 1 column or do I change
the value of a control in just one line of the subform.

I hope that makes sense and thanks in advance for any help.

Graham
 
Hi,
The usual way to do this is within the combo's query.
Let's say you have a query that pulls employee id, and first
and last names.
You'd want the bound (1st) column to be the id but you'd want
to display the full name.
So the combo's rowsource would be:
Select EmpId, lName & ", " & fName As FullName From tblEmp

Use the same principle and concatenate your data in the query.
 
Thanks, worked straight away, I'll add it to my ever increasing list of
problems/solutions that can't be found in the help.

Graham
 
-----Original Message-----
Hi.

I am writing an app where I have got a form with a subform, set as
'Continuous pages', on the subform one of the controls is a combo box. The
problem I need to get around is, the Combo box has a number of columns to
make selecting the right record easier, however when a record is selected
only rhe data from the first column is displayed.

My first idea was to put a label after the combo box and in the "After
Update" event put the data fron the 2nd column of the combo box into the
label, this worked fine except the value in the label appeared in every line
wthin the sub form rather than just in the line in question.

So how do I get the combo box to display more than 1 column or do I change
the value of a control in just one line of the subform.

I hope that makes sense and thanks in advance for any help.

Graham


.
Hi Graham, The reason the control returns on the the 1st
value after it has been updated is that the first column
is the one you have selected as the bound column. The
result you have observed is quite normal. There is no
easy fix. if you have populated the control from a query
or table you can run a query and then add text boxes for
the remaining colums and use the dlookup feature to return
the other values.
 
Back
Top