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

Status
Not open for further replies.

georgeong

Programmer
Mar 28, 2002
2
PH
I'm converting my old Paradox 4 DOS program to Delphi. And looking for a counterpart feature of
Paradox in Delphi

I have 2 tables with their fields listed below:


Product table - ProdCode OrderLineItem table - OrderNo
Description ProdCode
Unit Unit
Price Price
Discount Discount

If you're familiar with Paradox, specifying the -

Valcheck Define TableLookup {Product} AllCorrespondingFields on the ProdCode field of
OrderLineItem table

When editing the OrderLineItem table will have all corresponding fields with the same name
from Product automatically fill just by entering right ProdCode.

How do I duplicate this feature

Thanks - George


 
Is this what you want ?

Create 2 TQueries.

a) TQuery 1 will have 'Select * from OrderLineItem'.
b) Add a TDatasource for Query 1.

c) TQuery 2, add 'Select * from Product where ProdCode = :prodCode'
d) In TQuery 2, set it's datasource property to point to your TDatasource(for TQuery1).

In effect, query2 is being fed by the current record from query1 where the ProdCode's match. nb, query2's :prodCode must be the same name as is in the 'select' of Query1.

There are also Lookup fields you can add to a TQuery's Fields via the field editor and right button click 'Add new field'.

Am I on the right lines here ?

lou
[rockband]

 
There is a FAQ entitled How to use Database Look Up fields faq102-1212

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

Part and Inventory Search

Sponsor

Back
Top