Recent

Author Topic: (SOLVED) Index Based on Unknown field error (TDBf)  (Read 3417 times)

bill0287

  • Full Member
  • ***
  • Posts: 146
(SOLVED) Index Based on Unknown field error (TDBf)
« on: December 03, 2013, 06:20:24 am »
I am using an existing dbf file from an old Delphi app. I am trying to filter the TDbf data using something like this:

Code: [Select]
  If DBLookupComboBox1.Text <> '' then           // this is looking in a field called REGNAME
   with ReportDBf do begin
      Filter := DBLookupcomboBox1.Text;                       //I want to filter the table on all rows matching the REGNAME selected above
      Filtered := True;
      end;

When I run this I get the following error:

Index based on unknown field "<the value of whats in the lookup combobox>"

I have tried looking at the tdbf tutorial and some other example but still don't understand how to set up the Filter option correctly to do this.

Any suggestions?

UPDATE:

This code seems to be working:

Code: [Select]
  If DBLookupComboBox1.Text <> '' then
    with ReportDBf do begin
      Filter := 'REGNAME=' + QuotedStr(DBLookupcomboBox1.Text);
      Filtered := True;
      end;



« Last Edit: December 03, 2013, 07:50:31 am by bill0287 »

LacaK

  • Hero Member
  • *****
  • Posts: 691
Re: Index Based on Unknown field error (TDBf)
« Reply #1 on: December 03, 2013, 07:09:55 am »
What is in DBLookupcomboBox1.Text ?

bill0287

  • Full Member
  • ***
  • Posts: 146
Re: Index Based on Unknown field error (TDBf)
« Reply #2 on: December 03, 2013, 07:17:58 am »
It's the data from the field REGNAME from ReportDBF.

So for example, the DBlookupcombox1 has the value = Bob

The error message reads: Index based on unknown field "Bob".

I know I must not be setting the filter property correctly, but the examples aren't helping me.

 

TinyPortal © 2005-2018