KeyFields can be a single field name or a semicolon-separated list of fields.
KeyValue can be a variant or a variant array and the number of items must match the number of fields specified in KeyFields.
I wrote this function once for databases
unction MLookup(Veld, Tabel, Voorwaarde: string): variant; var mySql: TSQLQuery; begin mySQl := TSQLQuery.Create(nil); mySQl.DataBase := Form_RefereeMain.Connect_RefereeDB; try mySql.SQL.Text := Format('SELECT %s FROM %s WHERE %s', [veld, tabel, voorwaarde]); mySql.Open; // Result := mySQL.Fields[0].AsVariant; Result := MySQL.Fields[0].Value; finally MySql.Free; end; end; // MLookup