Fill bound text box from combo box?

L

Lee Hunter

I have a combo box with two column. I want to fill a
bound text box with one of the columns. The combo box is
already bound to another field.

I can acomplish flling the text box, as long as it's not
bound, but not when it is.

I have tried using the after update event for the combo
box by using a set value action to asign the value of a
combo box column, using the column property, to the bound
field name

Any Ideas?
 
D

Douglas J. Steele

Maybe try using VBA code rather than a macro.

Private Sub Combo2_AfterUpdate()
Me.Text4 = Me.Combo2.Column(1)
End Sub
 
G

Guest

The problem is not getting data into the form field, but
rather in to the data base. The data from the combo box
shows up in the form field, but when the recotrd is
updated the field is blank.
 
G

Guest

No, That is the basis of my question. I have the text
box control source set to the combobox.column(1), which
then "displays" the correct data in the text box. But
because the control source does not point to the data
base, it does not save the displayed data.

The underlying table for the database has a code field
and a description field

How do I get the combo box data column(1)(the description
to both display in the text box and and save it in the
data base, remember that column(0)(the code) is bound
directly to the database.

I sure would appreciate any advice that you could offer.

Lee
 
D

Douglas J. Steele

Bind the textbox to the field in the table that you want populated with the
value from the combobox.
 
G

Guest

Ah, but how. The text box field only has a "control
source" field, which is bound to the table. Where (in
what part of the text box control) do you put the
combobox info?
 
D

Douglas J. Steele

We seem to be having a inability to communicate here.

You cannot bind a textbox to a combobox. All you can do is use the code
you've been shown to update the value of the textbox whenever the combobox
changes. However, if the textbox is bound to the table, the table will be
updated with the new value.
 
L

Lee Hunter

Sorry to be so obtuse. I guess I was just out thinking
myself. Tried your suggestion and it worked perfectly.
Thanks so much for your patience.
 

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