Text box auto completion

  • Thread starter Thread starter Cheble
  • Start date Start date
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
 
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).
 
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/
 
Back
Top