Extracting data from a combo/list box

Tim L

Registered User.
Local time
Today, 21:42
Joined
Sep 6, 2002
Messages
414
I have combo box that displays three columns of data when the user clicks on it. When the user has made their selection the display reverts to just one (as I would expect - unless anyone can tell me how to get all still displayed...). I would like to have a text box reflect the contents of the remaining, now hidden, columns.

I figure that I should put my code in the After Update event and have tried the following:

Dim tmpStr As String

' build the data to be displayed
tmpStr = me.combo.value(2) & " " & me.combo.value(3)

me.txtBox.value = tmpStr

However this produces a Type Mismatch Error.

From experimenting I have determined that the statement

me.combo.value(n)

is the cause.

I'm fairly certain that I have heard of this being done before (and also think that I may have even done it) but I am having a bad brain day.

I've tried searching based on Combo and had a look at my subscribed threads but no luck. Am I dreaming or is it really not possible to do what I am trying to do???

Tim
 
=[MyCombo].[Column](1) &" " & [MyCombo].[Column].(2) as the control source of an unbound textbox on your form
 
Many, many thanks Rich!
 
Similar problem

:confused: I have a similar problem. It is the same senario except my combo boxes are being fed by a Query. I have 6 columns in my query, 3 cascading combo boxes and then 3 text boxes that will display the only available result of the selection on the last combo box. The first 2 combo boxes narrow the options for selection in the 3rd combo box. Then the selection in the 3rd combo box leaves a 3 part dimension (24x36x48) to display in the 3 text boxes.
Any ideas?
 
JeffreyDavid said:
Then the selection in the 3rd combo box leaves a 3 part dimension (24x36x48) to display in the 3 text boxes.
Any ideas?

Just base the data to be displayed in the text boxes on the value of the 3rd combo box, as explained above. You will, of course, actually need some data being displayed in the 3rd combo, a refresh/requery following each selection of the previous combo boxes should do this.

Also, you only really need two text boxes, you can have the other part remaining displayed in the combo box, just a thought.

HTH

Tim
 

Users who are viewing this thread

Back
Top Bottom