DBLookupComboBox Not in List lazarus / 16-Databases ---------------------------------------------------------------------- daveinhull · 2017-09-24 19:04 HI, Hope someone can help. I'm trying to deal with a new entry added by the user to a LookupComboBox. In MS Access we have a flag (LimitToList) and event (NotInList) to deal with this situation. I know these don't exist, so what I thought I'd do was to get the value entered when the DoEditingDone event fires and see if it is in the underlying table, if not I was going to ask the user if they wanted to add it and if so to bring up a new form to get all the data needed and then add it to the table behind the LookupComboBox and manually store the value in the associated data field of the ComboBox. However, when the DoEditingDone event fires, the value in .Text is empty, presumably because it has already detected that it is not in the dropdown list. Can anyone throw any light on what I could try next? Many thanks Dave ---------------------------------------------------------------------- taazz · 2017-09-24 20:24 I'm doing the opposite. I have a add buttong next to a dblookup that the users can press to add new values and when finished the dblookupcombo re query its data and auto selects the new value, ---------------------------------------------------------------------- daveinhull · 2017-09-24 20:53 I thought about that, but it didn't feel natural in the sense that the user would firstly go to the dropdown to look for the value and not find it, then have to go somewhere else, i.e. the button to add it, and then back and find what they had already tried to find (and it will be there this time). What I've done so far is to capture OnChange and keep track of the entered value. Then when the user exits the ComboBox it goes to OnExit. Here I first check if the .Text field is non empty which means the ComboBox found the entry so I just exit. If the saved value I'm collecting is blank then maybe the user wants to actually delete the entry so I ask and do what they want. If the saved value is non-blank then I look it up in the ComboBox underlying query (I don't think I actually need to do this because if it was in the Query it wouldn't get this far). Anyway, if it doesn't find it I know that it must be a new entry so then I ask the user if they want to add new data for the dropdown value they entered. If they say yes I bring up a new form and let them enter the new data (with the dropdown value they entered already completed). When they accept (cancel just drops everything) I get the new ID of the new value just entered and put it in the field attached to the ComboBox. Halfway through the code right now. Dave