Board index » delphi » Filtering on Lookup Field in a Table

Filtering on Lookup Field in a Table

I have a TTable containing a 'Lookup Field' attached to a DBGrid.  I wish to
Filter on values in the Lookup field however I cannot seem to get this to
work - I get run time errors saying I cannot filter on this field.  I am
doing it this way 'cos I need to be able to edit data in the DBGrid.  Any
ideas.

Thanks,

D Keay

Using Delphi 4, NT , BDE and Paradox tables (not client /server).

 

Re:Filtering on Lookup Field in a Table


Yep, use two tables, one for the lookup and the other for the grid.
ASS-U-MI-ing they are
keyed correctly, join the two tables, with the lookup as the master, indexed on
the lookup field.
Quote
David Keay wrote:
> I have a TTable containing a 'Lookup Field' attached to a DBGrid.  I wish to
> Filter on values in the Lookup field however I cannot seem to get this to
> work - I get run time errors saying I cannot filter on this field.  I am
> doing it this way 'cos I need to be able to edit data in the DBGrid.  Any
> ideas.

> Thanks,

> D Keay

> Using Delphi 4, NT , BDE and Paradox tables (not client /server).

Re:Filtering on Lookup Field in a Table


Quote
>I have a TTable containing a 'Lookup Field' attached to a DBGrid.  I wish to
>Filter on values in the Lookup field however I cannot seem to get this to
>work - I get run time errors saying I cannot filter on this field.  I am
>doing it this way 'cos I need to be able to edit data in the DBGrid.  Any
>ideas.

You will need to handle this in the onfilterRecord method.  Instead of the
lookup field use a different ttable to your lookup and findkey to locate the
lookup value you want to filter on.

--
Brian Bushay (TeamB)
Bbus...@NMPLS.com

Other Threads