Board index » delphi » How to filter records for a lookup field

How to filter records for a lookup field

Is it possible to use a query or some type of SQL statement to filter a
dataset used to extract values for a lookup field? My reason for asking is
that I would like to be able to create a new record in my Work Orders Table
using two lookup fields, CustLookup and AddressLookup, from inside a dbGrid
whereby the Addresslookup field shows only those records in the address
database table with CustomerNo equal to CustomerNo in the Work Orders Table
assigned by the CustLookup field in the grid. Also note that the CustLookup
field derives its values from Customer.db whereas the AddressLookup field
derives its values from Address.db. I am presently working with Delphi5 Pro
in Win98. Thank you ahead of time.
 

Re:How to filter records for a lookup field


Hi,

if you wnt to use SQL setetment you sould use Select with inner join betwwen
the two tables
to get a "lookup" field and in the Where clause you can filter from any
tables you want  that in the from clause
of the select statment.

look at any SQL book or refrence about the Select statment it is a vary
powerfull setatment that
can give you a lot

HTH
Yaron.

Quote
"Martin Potokar" <go...@hotmail.com> wrote in message

news:3c33ba65$1_2@dnews...
Quote
> Is it possible to use a query or some type of SQL statement to filter a
> dataset used to extract values for a lookup field? My reason for asking is
> that I would like to be able to create a new record in my Work Orders
Table
> using two lookup fields, CustLookup and AddressLookup, from inside a
dbGrid
> whereby the Addresslookup field shows only those records in the address
> database table with CustomerNo equal to CustomerNo in the Work Orders
Table
> assigned by the CustLookup field in the grid. Also note that the
CustLookup
> field derives its values from Customer.db whereas the AddressLookup field
> derives its values from Address.db. I am presently working with Delphi5
Pro
> in Win98. Thank you ahead of time.

Other Threads