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 fields

Status
Not open for further replies.

lespaul

Programmer
Feb 4, 2002
7,083
US
OK, I've been working for the past few days trying to get ADOquery(s) editable with my application and have failed. So, I'm switching them all to TQuery(s). Now I was super thrilled during this process to get Lookup fields to finally work. I set the key fields and they worked great! However, now that I've switched the queries to TQuery the look up fields FAIL! I get an error:

Capability not supported.

I thought perhaps it was the AS400 when I had problems with this the first time, but now I think it's some sort of problem with the query.

Anyone had any experience with this or know what I can check to figure out why it's not working? I was so thrilled when it was working with the ADO because I previously had written code to do all that and it was a PAIN!

Thanks for any insight!

Leslie
 
The default behaviour of TQuery is read-only.
Set Request Live = True to make the query editable.

Regards

Steven van Els
SAvanEls@cq-link.sr
 
I think you may have misunderstood my post.

I had set up ADO queries and lookup fields worked great. Unfortunately, I can't edit the data in the ADO queries.
Error: Insufficient base table information for updating or refreshing.

So, I changed all the queries to TQuery which I can edit, but the lookup fields don't work.
Error: Capability not supported.

So, I'm trying to figure out why the lookup fields work with ADO queries but not TQueries.

Thanks,
leslie
 
Look-up field work also with TQueries, maybe you have overlooked some detail, check out the FAQ area.

Regards

Steven van Els
SAvanEls@cq-link.sr
 
No, I set up the lookup fields exactly the same way for the ADO queries and the Tqueries.
 
Give some more details, Is you query made from more then 1 table?

Steven van Els
SAvanEls@cq-link.sr
 
Ok, I added an ADO query to the form (qryStatusCodes) :

SELECT * FROM JMPSTATUS ORDER BY DSPORD

returns:

STCODE STDESC DSPORD
WS Will Serve 1
PP Postponed 2
EM Excused Medical 3

These codes are a foreign key in JMPMAIN (which stores all the juror information). So I added a second ADO query to the form (qryJurorInformation).

SELECT * FROM JMPMAIN WHERE JURNUM = (criteria from search form)

I then added a new field to this query called 'JurorStatus'. I made it a lookup field, I selected the key values and the result values and it worked like a charm.

Then I had to switch all the queries from ADOquery to TQuery because I could not edit the DBEdit fields on my form using ADOqueries.

I re-created all my queries with the exact same names and lookup fields using TQueries. I can now edit the data, but the Lookup fields don't work. I have set them up exactly the same way, but I get the 'Capability not supported' error when the query tries to open.

About a year ago I was trying to get the look up fields to work with TQuery and had the same problem and gave up trying to get them to work. I assumed it had something to do with the AS400 and I had to code a lot of extra processes to mimic the lookup field.

Does that help?

Leslie
 
You added a new field called JurorStatus, does this field get his value from another table?

Steven van Els
SAvanEls@cq-link.sr
 
Yes it's a lookup field that gets it's value from the STDESC field in qryStatusCode.

So I have qryJurorInfo that has a field called Status, this will be WS, PP, EM. On the form I want to display 'Will Serve', 'Postponed', or 'Excused Medical'. So in the TreeView, I right click on the FIELDS, 'add new field', add the name 'JurorStatus', select Lookup Field, and select all the appropriate fields from qryStatus.

When I do it with ADO queries, it works, when I try to do it with TQueries I get an error message: 'Capability not supported'

Leslie
 
You have a table that gets his value from a look-up table, is this status something structural that will be used in other tables, or is it something that is temporary?
In the last case I would use a dbCombobox, dbListbox, or dbRadioButton. Then it would easy to filter out the conditions for your form.

If your purpose is to edit the underlying look-up table, you have to write a procedure to do this.



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

Part and Inventory Search

Sponsor

Back
Top