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!

Lookup combo box not working correctly

Status
Not open for further replies.

lespaul

Programmer
Feb 4, 2002
7,083
US
For the second or third time since I started this project, I am trying to get a combo box to work properly. I have two tables JMPMAIN and JMPSTATUS. JMPMAIN has a field called STATUSCD (WS, PP, EM, etc) JMPSTATUS has a field called STCODE (WS, PP, EM, etc) and one called STDESC ('Will Serve', 'Postponed', 'Excused Medical', etc).

What I would like to happen isn't really that difficult. I want the combo box on my form to display the Descriptions for the user to select from, but update the database with the Status code.

I have tried creating both DBLookupListBox and DBLookupComboBox with a lookup field defined in the qryJurorSearch to get the StatusDescription, but when the query becomes active I get an error message stating 'Capability not supported'. So I changed it from a lookup field in the query to using the ListSource & DataSource properties of the lookup boxes, which I can kinda get to work. The problems with the "working" example:
1. it does not display the selected text in the combo box (all I get is a blank combo box)
2. it only displays 2 rows of choices, even though the DropDownRows is set to 7
3. I tried to change the height (thinking that would allow more choices to show) from 24 to anything, but it's stuck on 24

If anyone has any suggestions on how to get this working properly, I would gladly try them! Thanks!

Leslie
landrews@metrocourt.state.nm.us

There are 10 types of people in the world -
those who understand binary
and
those who don't!
 
Leslie,

"Capability not supported" is usually a BDE error message indicating that you've tried something that's not supported by your database driver and or the table you've actually created. Without more specific information about the underlying data, it's hard to guess what that's referring to, but I'm pretty sure it's something basic.

For example, I got it once trying to open a FoxPro table that had an index that the BDE driver doesn't support.

If I'm following what you're after, it might be worth walking through an example using the DBDEMOS sample tables. Give this a shot and see if it makes sense.

1. Create and save a new application for this project.

2. Create a master-detail form with EVENTS as the master table and VENUES as the detail (link them on the common Venue Nofield. Go ahead and make them active.

3. Be sure to add DataSource objects on both tables and then drop two grids, one bound to each table. You should see one record in your Vendors table for each record in your EVENTS table. (If you like, you can add a DBNavigator bound to EVENTS to make things slightly easier to use while you're working on this.

OK; this brings things to a state where you can edit the Venue associated with each Event.

4. Add a TBDEClientDataset (or another appropriate dataset) for use with the lookup you want to do. Set its Database name to DBDEMOS and then set its CommandText to

Code:
select VenueNo, Venue from venues

5. Make it active.

6. Drop a TDataSource and bind it to the the tDataSet descendant you created in Step 4.

7. Drop a DBComboBoxLookup on your form and then set its properties as follows:

Code:
   DataSource: The DataSource pointing to EVENTS.DB
   ListSource: The DataSource from Step 6.
   DataField: VendorNo
   KeyField: VendorNo
   ListField: Venue

8. Save and run your application. You should be able to change the venue linked to a given event by selecting its name from the combobox.

9. Go ahead and scroll through the varius values in the combobox to verify this. As you do this, you should see updates being made to the VenueNo field in EVENTS and you should also see the linked VENUE data update as well.

To increase the number of items displayed in the combobox, change the DropDownRows property of the DBLookupComboBox. Keep in mind that if you enter a value larger than the actual number of items, you'll only see the number of items that actually exist. For example, if you set this to 24 and there are only ten records in the lookup dataset, you'll only see ten items in the drop-down.

Hope this helps...

-- Lance
 
Thanks for the info Lance, but I've done all that!! I think the capability not supported is due to the AS400 we are using. I think there must be a relational database in order for the BDE to be able to link the two. Of course, I'm just guessing.

I've worked around it by using a regular combo box and running lots of queries to get the data I want to display and relate it to the data I want to save.

Thanks for helping!


Leslie
landrews@metrocourt.state.nm.us

There are 10 types of people in the world -
those who understand binary
and
those who don't!
 
Leslie,

Ah. I have no direct experience with AS/400 machines, so I can't even begin to speculate on the cause of the error. However, I note that google returns some interesting matches for the following search:

Code:
   AS/400 "Capability not supported"

You might see if one of those are helpful.

The query alternative certainly works. Yes, it's more work, but at least you know what's going on then. For whatever that's worth. :-}

Hope this helps...

-- Lance
 
Check out the FAQ Area
How to use Look Up fields with Tables /Queries
faq102-1212

If it doesn't works that way then I think it must be a Database problem

Regards

Steven van Els
SAvanEls@cq-link.sr
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top