View Full Version : Bind text field to combo box data


Baldrick
11-29-2001, 09:11 AM
Judging from the posts, this group could use a good workshop in combo boxes.

I have a 3 column combo box that displays Work_Desc, Work_Loc and Work_Date. It's control source is Work_ID.

When the user selects a workshop from my drop-down list, I want to automatically fill the Work_Loc and Work_Date fields on my form. Work_Desc was easy 'cause that's the combo box value. I can't seem to apply the same logic to text fields.

Doable?

RoyVidar
11-29-2001, 09:38 AM
Hi!

Assuming your combos name is "cboTest", place the following controlsource in the three textbox controls

=cboTest.column(1)

The number one, refers to the second column in the combo, and for the next two, use 2 and 3.

Enjoy, Roy-Vidar

Baldrick
11-29-2001, 09:47 AM
Very simple. Thanks for the help RoyVidar!

Jack Cowley
11-29-2001, 10:14 AM
If you want to save the values from the Combo box to fields in your table you will need to put code like this in the After Update event of the Combo box:

Me![Work_Loc] = Me![ComboBoxName].Column(1)
Me![Work_Date] = Me![ComboBoxName].Column(2)

Baldrick
11-29-2001, 10:42 AM
Thanks Jack. That's good advice. I need to decide if I want/need to save that data in my Projects table.

jwindon
11-29-2001, 03:27 PM
For that "workshop" you mentioned...

Access Combo Box Survival Guide:
http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com/servicedesks/webcasts/wc080300/wcblurb080300.asp

If you don't have the time to kill, print out the transcript and read it.