[SOLVED] DBLookupComboBox don't select the ListSource record. lazarus / 16-Databases ---------------------------------------------------------------------- Galileo · 2017-03-16 18:43 Hi All. I'm trying to use a DBLookupComboBox and i can't get it work as expected. I attached a little example to show the problem. There are 2 DBF files Clientes (Clients) and Provincias (States). The Clientes files has a field PROVINCIA_ with the state's id corresponding. There are two forms. Form1 has a grid and an Edit button. Form2 show the edits fields and a DBLookupcombobox loaded with Provincia's file. By default, the DBLookupCombobox don't select the current Provincia. If you uncomment the following line at event Show it works fine. //DBLookupComboBox1.KeyValue:=Form1.Dbf_clientes.FieldByName('PROVINCI A_').AsInteger; There are something else to configure in the DBLookupComboBox's properties to work by default? I tryied it in Lazarus 1.6.2 in Linux (QT) and Windows 7 (native) and also in Lazarus 1.2.6 on Windows 7. Thanks in advance. Eduardo. ---------------------------------------------------------------------- howardpc · 2017-03-16 19:32 You need to give provincias.dbf a primary index on the ID field, and put the name of that index file in the appropriate property before primary-key-lookup based on that field will work as you want. ---------------------------------------------------------------------- Galileo · 2017-03-17 14:59 Thank you howardpc! It's working fine now. Regards. Eduardo.