Zoroaster
asked on
Search for record with secondary index.
I use this piece of code (from the Sams book) to search for a record in a db and I get the error message that the dataset is not in edit or insert mode (suppose this is because I use the SetKey command).
Can anybody tell me what's going wrong?
procedure TForm1.btnSearchClick(Send
begin
CustInfo.SetKey ;
CustInfo.IndexName := 'ByCompany';
CustInfo.FieldByName ('Company').asString := txtSearch.Text ;
CustInfo.GotoNearest ;
end;
ASKER
Yes, works fine. Sometimes small details can count...
Thanks, Matvey.
Thanks, Matvey.
ASKER
Hey, fill in an answer. I cannot give you the points, because you wrote this as a comment.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
CustInfo.IndexName := 'ByCompany';
CustInfo.SetKey ;
CustInfo.FieldByName ('Company').asString := txtSearch.Text ;
CustInfo.GotoNearest ;
Try also TTable.Locate...