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

Access Value from Unbound Column in Combo Box

Status
Not open for further replies.

dusterb

IS-IT--Management
Jun 13, 2005
21
US
I have a combo box with the following row source:
SELECT Company.Name, Company.CompanyID FROM Company;

The bound column is the Company.CompanyID (column 2). I use a column count of 1, so the combo box ends up displaying a pulldown of Company.Name. That's what I want.

I'm trying to pass Company.Name as an OpenArgs to another form through a command button. Forgive the novice question, but I can only get the actual bound column value Company.Company.ID to pass. Is there a way to access the unbounded value, or do I need to run a query over on the form which receives the Company.Company.ID OpenArg in order to retrieve the associated Company.Name?
 
Have a look at the Column property of the ComboBox object:
[combo name].Column(0)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I was working with that and I'll back and try again, but I was wondering if it was applicable seeing as I've set the column count to only 1 (only a single column).
 
Whoops, stupid error. It is columns 0 and 1, not 1 and 2. Sorry to bother. Thanks.
 
Why setting the column count to 1 when the rowsource returns 2 fields ?
Play with the ColumnWidths property if you want to hide a column.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
As PVH says...

I always make the bound column to be 1 (the ID) but set it to zero width (combo box property) e.g.

0cm;2cm;

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top