Need to update a field with only allowed values. lazarus / 16-Databases ---------------------------------------------------------------------- jack · 2012-02-13 08:40 I need a table that is accumulating payroll data for employees over time. I want to create an entry (row) for each employee who works on a specific date and add new rows for each subsequent set of employee- work days; keeping track of what the employee did and how long he worked on each item. Many fields in the table must be limited to a specific set of values. For example the job name to which the time is charged,  This information comes from another table of jobs.  The employee id is selected from the employee table.  The pay rate for a specific activity comes from a job_rate table and so on. Although a grid is an easy way to update data, I cannot see how to use a lookup within a grid to change or insert data into  a field.  I could build a page full of edit boxes for each field but I need an edit box with limited selections.  The TDBLookupComboBox looks like the answer because it can connect to two different tables but I cannot get it to work.  This must be a common requirement so there must be a simple solution, any help is appreciated. ---------------------------------------------------------------------- ludob · 2012-02-13 14:01 You can easily put drop boxes in a DBGrid but you need to use fixed column definitions (as opposed to a dynamic dbgrid that adapts automatically to your dataset). Select the dbgrid, Click on columns (the ellipsis). A column editor pops up. Click on add to add a new column. Select Fieldname from the dropdown list in Object Inspector. Repeat this for every column you want to show. To create a dropdown box for a column, double click on PickList and add your list of keywords. Make sure ButtonStyle is set to cbsAuto or cbsPickList. ---------------------------------------------------------------------- Mando · 2012-02-13 15:46 Check this: http://delphi.about.com/od/usedbvcl/l/aa081903a.htm It is for delphi, I haven't checked it for Lazarus, I'll do. regards ---------------------------------------------------------------------- jack · 2012-02-14 21:27 Thanks, study of these references helped a lot. ---------------------------------------------------------------------- jack · 2012-02-15 16:09 My Solution was crude but worth sharing. I placed an invisible TDBLookupComboBox directly over the field I wanted to control and set the OnClick event of the underlying TDBEdit to make the TDBLookupComboBox visible.  I then set the OnSelect event of the TDBLookupComboBox to first copy its Text field into the text field of the underlying TDBEdit and then make itself invisible again. When the user clicks to edit the TDBEdit the TDBLookupComboBox appears offering its selections, when the selection is made the select list disappears and the edit is filled in. "There are more ways to kill a cat than by choking it with butter." Bro. Giles Vincent