Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Populate text box with drop down

Status
Not open for further replies.

ptrifile

Technical User
Aug 10, 2004
457
US
I have a simple table that has 2 fields, one is AGENTNAME and the second is DEPARTMENT. I have a drop down to choose an agents name, how do I have a separate text box populate with their coresponding department? Can someone help me?

Thanks!

Paul
 
If your dropdown (combobox) has the rowsource set to:

SELECT AgentName, Department FROM TheTable

You can set the textbox to:

=Me.NameOfDropdownHere.Column(1)

Note that the column count starts from zero, this is not the same as the property Column Count, which should be set to 2. You can set the column widths to, say, 2cm,0cm, if you do not wish department to show in the dropdown.
 
Remou, thank you for the help! When following your direction I get a "#Name?" in the text box....is there something im doing wrong?

Paul
 
Probably not. I constantly add Me, which does not work in textboxes [blush]

=NameOfDropdownHere.Column(1)
 
Thank you that worked great! however it brings me to one more question....how can i have what is populated in the text box written back to the table for that record.

Thanks again!

Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top