Display Multiple Columns in a Text Box

  • Thread starter Thread starter Pete
  • Start date Start date
P

Pete

I'm sure there are a million easy ways to do this, but I
haven't been able to find one yet.

I want to allow a user to select a row from a list box.
Each row contains an ID, Last Name, First Name, and
Middle Initial. I want the ID to go into my database
field and this is working fine. I want all three of the
name fields to display in the text box, but I can only
get the first field to display after a selection is
made.

I would be very grateful if anyone can point me in the
right direction.

Thanks!
 
And then, right after sending my reply, I find that I misread your post.
Sorry.

You can use the Column property of the listbox to get the values from the
other columns. For example, if you wanted to display the values from columns
2 and 3 in a textbox, separated by | character:

Me.TextBoxName.Value = Me.ListBoxName.Column(1) & "|" &
Me.ListBoxName.Column(2)

Column is a zero-based property, so the first column is actually column 0,
the second column is column 1, etc.

Note that the above will work only for a single-select listbox.
 
Back
Top