Question and Answer Database FAQ2114D.txt using the Lookup method to return values from multiple columns Category :Database/VCL Platform :All Product :All 32 bit Question: How do I use the Lookup method to return values from multiple columns? Answer: The result is a variant array -- one index to the array for every column specified in the KeyValues parameter: procedure TForm1.Button1Click(Sender: TObject); var MyResults: Variant; MyKeyFields, MyKeyValues: String; MySearchForValue: Integer; begin MyKeyFields := 'CustNo'; MySearchForValue := 1351; MyReturnColumns := 'Company;Addr1'; MyResults := Table1.Lookup(MyKeyFields, MySearchForValue, MyKeyValues); if not VarIsNull(MyResults) then ShowMessage('Company: ' + MyResults[0] + ' Address: ' + MyResults[1]); { With DBDemos data this returns "Company: Sight Diver Address: 1 Neptune Lane" } end; 7/16/98 4:31:28 PM
Last Modified: 01-SEP-99