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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select data from list box

Status
Not open for further replies.

Grieg

Technical User
Sep 13, 2002
20
GB
I have a form with a combo box (cmbUser) and two text boxes (txtUser & txtBranch). The combo box has 2 columns. When an item is highlighted in the combo box and the user clicks a select button I need to set txtUser to the data in column 1 and set txtBranch to the data in column 2. The data from the columns also needs to be stored in 2 public strings (pblUser & pblBranch).

I can do this ok with just one column but can't figure out how to get the data from the other column. The code I have for the first column is;

pblUser = Me!cmbUser
txtUser.Value = pblUser
txtUser.Requery

Could anyone help?
 
Hi!

Use this code:

Dim intRow As Integer

For intRow = 0 To Me!cmbUser.ListCount - 1
If Me!cmbUser.Selected(intRow) = True Then
txtBranch.Value = Me!cmbUser.Columns(1, intRow)
pblBranch = txtBranch.Value
Exit For
Next intRow

hth
Jeff Bridgham
bridgham@purdue.edu
 
Jeff,

Thanks for your help -its much appreciated.

Grieg.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top