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

Bound Combo Box help

Status
Not open for further replies.

Draug

Programmer
Apr 18, 2001
77
CA
Greetings,

I have a combo box that is linked to a lookup table of possible values.

The table looks as follows:
ID | DESCRIPTION
01 | Inactive
02 | Suspended
03 | Active
...| ...

Now, my combo box retrieves both colomns, but the first colomn (ID which is the Primary Key) is set to a width of 0 so it does not show. Thus, the user sees Inactive, Suspended, Active, etc. The box is bound to the second colomn, so 01, 02, 03, etc is stored in the database.

My problem is that I would like to place the selections in a text message to the user, and when placing the combobox.value in the text, I get the 01, 02, 03, which means nothing to a person. I could query the look up table for the description column where the ID matches the value of the combo box and then use that as my text, which would solve my problem....

BUT, since Access is displaying the description right on the screen, there must be a property I can use to get it. Of course, I cant determine how.

Can anyone tell me if there is such a property, and what it is? If not, do you have any better ideas that just querying out the description?

Thanks for the help,
Draug
 
You can pull that text into a value using the following syntax:

value = Combobox.Column(column[,row])

Column is zero-based, so if the text you need is in the second column, you would retrieve that value using:
Code:
combobox.Column(1)
 
Point 1 : You are RIGHT, there must be a property

Point 2 : The property is COLUMN


So if you combobox control is called cboStatus and the control is displaying "Active" then:-

cboStatus = 03
cboStatus.Value = 03 ( Free Hint: .Value is a waste of typing )

cboStatus.Column(0) = 03
cboStatus.Column(1) = "Active"

The above works for any number of columns - so is the 'default solution'. However, if you only have ONE text column then you can use:-
cboStatus.Text = "Active"



'ope-that-'elps.

G LS
 
Thanks for the help folks. Works like a charm! :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top