Text box auto completion

C

Cheble

Hi

I have a drop down combo box with user names in.
Each user belongs to a team. I want another text box to
display the correct team name depending on the user name
selected from the combo box.

How can I do this?

Any help would be appreciated.

Thanks
 
D

Dan Artuso

Hi,
The easiest way to do it would be to include the team in the query that feeds
your combo box. Just make that column invisible. Then set your text box
to the value of that column.

Something like this in the After Update event of your combo:

Me.yourTextBox = Me.yourCombo.Column(2)

Replace 2 with the correct column.
Remember though that the first column is actually column(0).
 
M

Mark Phillipson

Hi,

If you have your table stuctued like the following:

UserName TeamName
"Fred" "Team A"
"Susan" "Team A"
"Jack" "Team B"

Set the ComboBox properties as follows:

RowSource = "Select UserName, TeamName From TableName Order By UserName"
ColumnCount = 2
ColumnWidths = "2cm;0cm"

Then enter the following code in the ComboBox After Update Event

Me.txtTeamName = Me.cboComboBoxName.Column(1)

HTH
--

Cheers
Mark

Free Access/Office Add-Ins at:
http://mphillipson.users.btopenworld.com/
 

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