How to filter a Lookup directly without filtering the Table

How to filter a Lookup directly without filtering the Table

Post by tw » Sun, 31 Dec 1899 09:00:00



Hi all
My problem is I need to filter the data displayed in a DBlookup without
using a table for the filtering.
For example.
A database table with several fields, 2 called "KeyWord", "TableName". In a
particular entry the keyword field may be = to "Maintenance Type", and the
field TableName =  "Planned Work" however scattered throughout the table
would be various entrees with the "KeyWord" Maintenance type and Table name
= to whatever.
Normally I would use a table filtered for the KeyWord =  "Maintenance Type"
then the Lookup pointing to the filtered table and only the values with
TableNames with Keyword = Maint..Type displayed in the lookup.

The trouble with the above approach is a table is needed for every different
Keyword in the Table and in this particular table there are about 40! Is
there a way to filter by only using the Lookup.
Thanks TW

 
 
 

How to filter a Lookup directly without filtering the Table

Post by PINK » Sun, 31 Dec 1899 09:00:00


Don't forget that you can use the "onfilterrecord" event to code exactly the
filter logic you want, in good old Pascal. If you need to pass parameters
between a control and the onfilter event (say, a series of partial keys
entered by the user in a tedit), simply put the required variables in the
private section of your form. If it can't be coded in Pascal, it probably
should not be attempted.

Robert


Quote:> Hi all
> My problem is I need to filter the data displayed in a DBlookup without
> using a table for the filtering.
> For example.
> A database table with several fields, 2 called "KeyWord", "TableName". In
a
> particular entry the keyword field may be = to "Maintenance Type", and the
> field TableName =  "Planned Work" however scattered throughout the table
> would be various entrees with the "KeyWord" Maintenance type and Table
name
> = to whatever.
> Normally I would use a table filtered for the KeyWord =  "Maintenance
Type"
> then the Lookup pointing to the filtered table and only the values with
> TableNames with Keyword = Maint..Type displayed in the lookup.

> The trouble with the above approach is a table is needed for every
different
> Keyword in the Table and in this particular table there are about 40! Is
> there a way to filter by only using the Lookup.
> Thanks TW


 
 
 

How to filter a Lookup directly without filtering the Table

Post by Bruce Robert » Sun, 31 Dec 1899 09:00:00



Quote:> Hi all
> My problem is I need to filter the data displayed in a DBlookup without
> using a table for the filtering.
> For example.
> A database table with several fields, 2 called "KeyWord", "TableName". In
a
> particular entry the keyword field may be = to "Maintenance Type", and the
> field TableName =  "Planned Work" however scattered throughout the table
> would be various entrees with the "KeyWord" Maintenance type and Table
name
> = to whatever.
> Normally I would use a table filtered for the KeyWord =  "Maintenance
Type"
> then the Lookup pointing to the filtered table and only the values with
> TableNames with Keyword = Maint..Type displayed in the lookup.

> The trouble with the above approach is a table is needed for every
different
> Keyword in the Table and in this particular table there are about 40! Is
> there a way to filter by only using the Lookup.
> Thanks TW

I'm not entirely clear on why you believe you need 40 different tables. Is
it that you have 40 different lookup combos on the same form? If so you
don't have many other options. OTH if its just a case of changing the filter
at run-time simply do something like
    aTable.Filtered := False;
    aTable.Refresh;    // if multi-user
    aTable.Filter := '[KeyWord] = "Maintenance Type"'; // whatever
    aTable.Filtered := True;
 
 
 

1. Filtering table already filtered .....

Hi ,
     j have one problem ......
J have one table with 5003 records and there is a button that open a filter
form.
In this form there are :
#1 TQuery                 (Query1)
#1 TDBGrid              (DBGrid1)
#1 TDataSource      (DataSource1)

DBGrid1 is linked to DataSource1 and DataSource1 is linked to Query1

Now j filter the table with the Query1.Sql and the line is :

Query1.SQL.Add('Select * FROM '+TT.TableName+' WHERE Brand' Like '
+QuotedStr(FilterEdit.Text));

Where :
TT.TableName is the table name (MyTable.DB)
Brand                is one record's field
FilterEdit           is the TEdit component (the value is 'band%')

When j run the query j will find about 1000 record ( given by
Qurey1.RecordCount ).
At this point j need to refilter the query ..... but how is possible ??????

If j try to do this

Query1.SQL.Add('Select * FROM Query1  WHERE Brand' Like '
+QuotedStr(FilterEdit.Text));

when j run the query j will get this error
File or directory does not exist :
C:\......\.....\Query1.DB
C:\.......\.....\Query1.DBF
C:\........\.....\Query1.TXT

What j can do to refilter this table ???

Thanks for your help

Bye

Daniele

2. VB - Unicode and Oracle Stored Procedures........Help

3. Filter on lookup table

4. Column comments in SQL Server?

5. Filtering a lookup table in PDXWin 4.5

6. PowerDesigner doesn't work on '98?

7. : Filters and Table Lookup?

8. nudder newbie dumb question (Error 94)

9. Unable to filter on table lookup fields

10. Filtered lookup table

11. Filtering a Lookup Table

12. Verical filtering without modifying table structure

13. Join Filters not filtering