Use the Lookup method to retrieve values for specified columns from a row that matches search criteria. KeyFields is a string containing a semicolon-delimited list of column names on which to search. KeyValues is a variant array containing the values to match in the key columns. To specify multiple search values, pass KeyValues as a variant array as an argument, or construct a variant array on the fly using the VarArrayOf routine. ResultFields is a string containing a semicolon-delimited list of column names whose values should be returned from the matching row.
Lookup returns a variant array containing the values from the columns specified in ResultFields. Lookup uses the fastest possible method to locate matching rows. If the search columns in KeyFields are indexed, Lookup uses the index. Otherwise Lookup uses a brute-force row scan for the search.