DBLookupComboBox exception lazarus / 16-Databases ---------------------------------------------------------------------- Old Dog · 2011-03-08 04:20 using lazarus 0.9.28.2 fpc 2.2.4 have a dbf table of states with abbreviation, statename, etc have dbf table of vendors with vendorstate (abbreviation stored) , etc have vendor form with grid and dblookupcombo for state using object explorer: set listsource to dsstate      listfield     to statename      keyfield     to abbreviation      datasource to dsvendor      datafield     to vendorstate when vendor table is created (no records) get exception can't convert null to string if I create a record and place a valid abbreviation value in vendorstate, no exception.  DBLookupComboBox works as expected any ideas on why and a work around? ---------------------------------------------------------------------- Old Dog · 2011-03-08 23:13 seems I was a little hasty in saying things worked fine.  get the same exception when I attempt to add new record to table. ---------------------------------------------------------------------- Old Dog · 2011-03-09 19:59 It seems that the problem exists because the DataField, VendorsState, is empty when a new record is created, either by append or by creation of the DBF file.  Is there a way to initial a field? I can make the exception go away by leaving the DataField property empty in the object explorer, but then it doesn't do me any good either. ---------------------------------------------------------------------- jesusr · 2011-03-11 21:06 please try with a newer lazarus revision, for example any snapshot of lazaus fixes should be fine. If it still raises the exception, please submit a bug report with a sample project. ---------------------------------------------------------------------- Old Dog · 2011-03-13 03:24 having had no luck in upgrading  FPC from 2.2.4 to 2.4.0 or 2.4.2, I am not sure i can get a snapshot to work.  Nor do I have a clue how to get one. I have, however, found a partial solution.  Using the OnNewRecord event of the DBF, I can set the DataField.text := 'XX' and avoid the exception generated from append.   I assume a single space in the quotes (' ') will also work but have not tested it yet. This does not solve the problem when a new file is created, or an empty file is opened.