Board index » delphi » Filtering on Lookup field display value

Filtering on Lookup field display value

I'm using all vanilla Delphi 6 (w/UP1) components
including a TDBGrid, TADOConnection, TDataSource,
and 2 TADOTables (one for the grid and one for a
foreign key lookup - to display the name of the referenced
item instead of the ID value.)

It all works great, but my client wants to be able to
filter and sort on the value appearing in the lookup
field.

Is this possible?

Attempting to filter using the lookup field display
value causes an EOleException
"Item cannot be found in the collection corresponding
to the requested name or ordinal"

At runtime the TADOTable.Fields.Count = 11
and TADOTable.RecordSet.Fields.Count = 10

So I suspect that under the covers the recordset
knows nothing of the lookup field and the filter
is being applied to the recordset.

Any guidance would be appreciated.

Thanks,
Mike

 

Re:Filtering on Lookup field display value


Quote
>It all works great, but my client wants to be able to
>filter and sort on the value appearing in the lookup
>field.

Generally the Answer is No. Using a Tclientdataset would be the exception.
--
Brian Bushay (TeamB)
Bbus...@NMPLS.com

Other Threads