Posted by webmaster Guido on January 22, 2010
In Reply to Re: DbGrid/EditBox Search posted by Farhan Karimshah on January 21, 2010: I'm using ADO/MS ACCESS database or dBase(DBF) I haven't permenantly decided but I'm not sure how to index either of them.
: The Code I tried for locate was:
: Table1.Locate('CODE', [Edit1.Text], );
: THANX :)
1. For indexing a DBF table, you can use the utility "Database Desktop" that is included with Delphi. Usually it's located at "Program Files\Common Files\CodeGear Shared\Database Desktop\dbd32.exe" or "Program Files\Borland\Database Desktop\dbd32.exe". If you have a shortcut or start menu item for it, of course you also can use that one.
Let's assume that your table is PRODUCTS.DBF and you want to index it on the field "CODE":
1.1 Open PRODUCTS.DBF (menu: File - Open - Table)
1.2 Click menu: Table - Restructure
1.3 Under the box "Table properties: Index", click the button "Define"
1.4 In the Field list, select the field "CODE", next click the OK button.
1.5 The window that opens shows "Index tag name: CODE". Click OK.
1.6 Click button "Save".
1.7 Close the table and exit from the Database Desktop application.
2. For using the function Locate: sorry, I was wrong, I quoted from memory instead of looking it up in the Help. Mea culpa...
The correct code is as follows (also corrected it in my previous message):
Table1.Locate('Code', Edit1.Text, )