identifying a column in dbgrid lazarus / 16-Databases ---------------------------------------------------------------------- davesimplewear · 2010-04-16 07:04 I am trying to locate field in a table from the dbgrid, I can't seem to find the identifier (probably the wrong way to decribe it) in the grid, using the locate method Tsqlite3.Locate('itemnum',"dbgrid entry colomun",[loCasInsenstitive,loPartialKey]), i have tried the column.fieldName property to no avail, is there a way to do this? Regards Dave PS. the entry could be manual or by barcode scanner. ---------------------------------------------------------------------- davesimplewear · 2010-04-17 05:59 Anyone able to help? Regards Dave ---------------------------------------------------------------------- thaimann · 2010-04-17 13:17 If it is a string, there could be extrenous spaces on the end of the string.  Try writing a strip function an  then try your locate on that.  I have had this trip me up in Delphi multiple times.  Also, try using the Partial key search, ie: Locate('value', key, [loPartialKey]); I don't know how well this works in Lazarus, since I use mostly MySQL and the search routines never have been implemented there. Terry ---------------------------------------------------------------------- davesimplewear · 2010-04-17 21:05 Thanks Terry, I am trying to find the text property of the column to use that as the key value in the locate function, I can do this with a StringGrid but not a dbGrid and I am looking for a way to do that. Regards Dave ---------------------------------------------------------------------- jesusr · 2010-04-19 16:26 So you want to find the value on a cell of dbgrid?, DbGrid is just a visual representation of underlaying dataset, so instead of looking for the value in the grid, you should check the dataset itself. A column is bound to a field through the columns' FieldName property, if you want to know what field is associated with the currently selected column, it would be DbGrid.SelectedColumn.FieldName, for any other column DbGrid1.Columns[x].FieldName. Once you have the columns fieldname, to get the string representation of the field's value use Dataset.FieldByname(ColumnsFieldName).AsString or Dataset.FieldByname(ColumnsFieldName).DisplayText For the case of current column there is a shortcut in dbgrid, DbGrid1.SelectedField,AsString or DbGrid1.SelectedField.DisplayText ---------------------------------------------------------------------- davesimplewear · 2010-04-19 20:33 Thank you for the info, that was what I was looking for. Regards