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

Combo Box Bound to Column 2 (Integer) 1

Status
Not open for further replies.

Auguy

Programmer
May 1, 2004
1,206
US
I have a combo box with the fields: UserName and User_ID. The combo is bound to User_Id which is an integer. How do I get the combo to correctly use the bound column? I have seen some info on using a Select in the combo itself, but not sure how I can do this?

Auguy
Northwest Ohio
 
I have 2 columns in the record source and the boundcolumn set to 2 which is the User_Id integer field. In the RowSource I have ProjUserList.UserName,User_Id. I have RowSourceType set to 6-Fields. I also only display the UserName column. When I try and set the value to something like 1025, the combo interprets it as the ListIndex (I think). I have found other web references to having to use an SQL statement to get around this problem, but was wondering if there was some other way. For now I'm converting the integer to a string and using that as the boundcolumn and changed any related code accordingly.

Auguy
Northwest Ohio
 
Make sure to set the combo's BoundTo property to .T. This badly-named property allows you to bind to a numeric value. When it's set to .F., it assumes that a numeric binding should be the row index.

Tamar
 
Thanks Tamar. I must be getting old. Your reply caused a few of my memory cells to refresh. I seem to remember reading something about that property a long time ago.

Auguy
Northwest Ohio
 
YOu're welcome. FWIW, there's no reason not to set BoundTo to .T. in your base combo class. It's rare to want the default behavior.

Tamar
 
Good tip, will do.

Auguy
Northwest Ohio
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top