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!

Selecting an item from a DataCombo using the Index ID

Status
Not open for further replies.

rickyoswaldiow

Programmer
Jul 16, 2007
127
GB
Good morning all. I have a DataCombo control (not to be confused with ComboBox) which is populated with data. I am wondering how I can display the Description (ListField) text by referencing the Index ID (BoundColumn) i.e.

I have three entries in the DataCombo
0. Red
1. Green
2. Blue

I want to reference which is to be shown by the number, but I want the string to be displayed.
 
I've found the source of my problem. I was using the .BoundText property which was right, but we were setting it to:
Code:
Me.cboDataCombo.BoundText = "" & !Record

The mistake here is including the '"" &'. Simply removing this fixed the problem.
 
The concatenation of a blank string to a field value is to convert any null values in a field to a blank string. If you don't, you'll get an "invalid use of null" error, because you can't assign a null value to a text box's text property. When you concatenate an empty string to the field value, then if there's a value in the field, it won't be changed, and if there isn't, it will be changed from Null to a blank string.

I'd recommend that you test the behavior of your control when encountering a null value if you haven't already.

Bob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top