Subject Re: [IBO] Searching within a TIB_Query?
Author Chef
Hi Chris,

just use:

if IB_Query1.Locate( 'YourIDFieldName', iYourIDValue, [] ) then
ShowMessage( 'Found !' );
IB_Query1.Locate( 'Field1;Field2', VarArrayOf([Value1, Value2]), [] );
// I'm not sure if it is "VarArrayOf()" or "VarArrayCreate() - I have no
Delphi at hand.


At 11:28 11.12.00 -0600, you wrote:
>I am attempting to convert from the Borlands TTable to TIB_Query because of
>a problem with arrays from within Interbase Database working with the BDE.
>I am using a simple "SELECT * FROM TABLE_JOBCLASS" command to populate the
>TIB_Query. But I wish to move my cursor to the row based on a value entered
>by the user in my application. The value is a simple integer for a field
>named ID within the Table named TABLE_JOBCLASS. How do I do this with IBO
>and I have some sample code of how I did this with TTable in C++ Builder?
>TIB_Query *Table_JobClass; // Previous Represented by TTable
>void __fastcall TForm_JobClass::Button_SearchClick(TObject *Sender)
>AnsiString SaveKey;
>if (SearchForRecords()) // User Enters Value for ID field
> {
> Table_JobClass->Cancel();
> SaveKey = Table_JobClass->IndexFieldNames; // NOT SUPPORTED
> Table_JobClass->IndexFieldNames = "ID"; // NOT SUPPORTED
> Table_JobClass->EditKey(); // NOT
> Table_JobClass->FieldByName("ID")->AsInteger = Search_ID; // Value ID
> >from User
> Table_JobClass->GotoKey(); // NOT SUPPORTED
> Table_JobClass->IndexFieldNames = SaveKey; // NOT SUPPORTED
> }
>Any help would be greatly appreciated. I am sure that there is a better way
>to search and move the cursor to the desired record with TIB_Query but I am
>a little new to the IBO game.
>Chris Hulsey
>Visible Changes, Inc.