Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Using a listbox/combo box to show two values


Hi there,

I'm currently using a list box to display a single list of Manager
names (defined on another sheet as 'Names')
the listbox on_click subroutine stores the value of the list box into a
text box for the user to see what they have selected.

this text box value then gets passed into another subroutine that uses
it in some SQL.

On my defined range of names, I need to add a second column -
manager_id.

this must also be passed into the SQL subroutine, but I have no idea
how to do this.
it doesn't necessarily have to be displayed in the list box (or combo
box, if more suited), but I need to pass both the name and the id into
the SQL subroutine.

can anyone give me some guidance with this?
thanks,
Matt


--
matpj
------------------------------------------------------------------------
matpj's Profile: http://www.excelforum.com/member.php...o&userid=21076
View this thread: http://www.excelforum.com/showthread...hreadid=512156

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Using a listbox/combo box to show two values

When you load the listbox, either use a 2D array (Range(A1:B10), or if being
loaded singly, do so like this

With lstManagers
.AddItem hisName
.List(.ListCount-1,1) = hisId
.etc
End With

obviously you will need to add the values

To get it back you simply use

hisName = lstManagers.Value
hisId = lstManagers.List(lstManagers.ListIndex, 1)

By not setting the ColumnCount property of the listbox, the id will not be
displayed.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"matpj" wrote in message
...

Hi there,

I'm currently using a list box to display a single list of Manager
names (defined on another sheet as 'Names')
the listbox on_click subroutine stores the value of the list box into a
text box for the user to see what they have selected.

this text box value then gets passed into another subroutine that uses
it in some SQL.

On my defined range of names, I need to add a second column -
manager_id.

this must also be passed into the SQL subroutine, but I have no idea
how to do this.
it doesn't necessarily have to be displayed in the list box (or combo
box, if more suited), but I need to pass both the name and the id into
the SQL subroutine.

can anyone give me some guidance with this?
thanks,
Matt


--
matpj
------------------------------------------------------------------------
matpj's Profile:

http://www.excelforum.com/member.php...o&userid=21076
View this thread: http://www.excelforum.com/showthread...hreadid=512156



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
listbox or combo box and how? Kim K Excel Discussion (Misc queries) 13 March 4th 06 12:28 PM
Listbox or Combo advise Greg Brow Excel Worksheet Functions 1 February 16th 05 05:43 PM
Fill values into a listbox matching selected values from a combobox Jon[_19_] Excel Programming 4 January 25th 05 04:25 PM
Configure Combo Box to Show Unique List Values Only? [email protected] Excel Programming 2 February 5th 04 02:26 PM
Sorting ListBox results or transposing ListBox values to other cells for sorting Rob[_8_] Excel Programming 1 July 9th 03 04:35 AM


All times are GMT +1. The time now is 09:26 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"