DBLookupComboBox displays by default ListField(s) , whose KeyField in ListSource corresponds to ListSource in DataSource . Thus, to display some value for a DataField that is NULL, you must specify KeyField NULL in the ListSource . But you can imagine that you do not need to have a NULL value in the underlay table associated with the ListSource .
One way around this is to add a NULL value to the dataset behind the ListSource using UNION SELECT . This should work fine, as this dataset should not be editable.
Now, to make sure that this special data set is only available when adding a new record to the data set associated with the DataSource , run the query for ListSource.DataSet in DataSource.OnStateChange . When DataSource.State = dsInsert , update ListSource.DataSet .
source share