DBLookUpComboBox and 'invalid variant type cast' lazarus / 16-Databases ---------------------------------------------------------------------- rise_nak · 2011-06-16 20:03 Hello, I'm trying to use DBLookUpComboBox to make something like a filter for a DBGrid. I put DBLookUpComboBox1 on the form and on buttonclick I have the following code: Code: [Select]DBLookupComboBox1.DataSource := FormKraj.DataListaWalut;   DBLookupComboBox1.DataField := 'SYMBOL_I_PANSTWO';   DBLookupComboBox1.ListSource := FormKraj.DataListaWalut;   DBLookupComboBox1.ListField := 'SYMBOL_I_PANSTWO';   DBLookupComboBox1.KeyField := 'WAL_ID'; ListaWalutQuery.Open; ListaWalutQuery is connected with DataListaWalut datasource. I have also DGGrid with DataSource := DataListaWalut and everything is ok, so I think that a problem is somewhere in  DBLookupComboBox. When I click button I got an error 'invalid variant type cast' , debugger shows that a problem is in function TDBLookup.ListFieldValue. Than I got an error 'invalid value for field 'WAL_iD'' and debugger shows the same line. List is filled by values from field SYMBOL_I_PANSTWO, as it should, but when I choose a position from list I  got the same error 'invalid variant type cast' and 'invalid value for field 'WAL_iD''. Code: [Select]ListaWalutQuery.SQL := 'SELECT a.*, a.WAL_SYMBOL||' - '||a.WAL_PANSTWO as SYMBOL_I_PANSTWO FROM WALUTY_TABELE a;' What an i doing wrong? ---------------------------------------------------------------------- woffleys · 2011-12-30 14:11 I have had the same problem, however, I have made a change to the code in dblookup.inc to fix this. if its not fixed, change 'VarArrayOf([AListFieldValue])' to 'AListFieldValue' in procedure TDBLookup.UpdateData(const AListFieldValue: string); around line 392