Hello Eyeman,
What does the code procedure frmEmployees_OnShow (Sender: TObject; Action: string) do?
The original example application was created by Fabio (Reteinformatica) and has had a number of changes made to it in the meantime so I would guess that this procedure (although now empty) has just been left behind.
You have used the procedure frmEmployees_TableGrid1_OnCellClick (Sender: TObject; ACol, ARow: Integer); to activate the search button, and not used incremental search in tablegrid1. Is it because the search is on a different table, not directly related to tablegrid1?
Again, it's not my code but, rather than use 'incremental search', I imagine Fabio has done it like this to avoid the situation where frmemployees.tablegrid1 loses focus (for example, after a record has been deleted). If you then immediately click on the column headings to do a re-sort, it causes the 'incremental search' button to be triggered without any focus on a particular row in frmemployees_tablegrid1 and so ALL rows in frmemployees_tablegrid2 are retrieved; this might be a bit confusing for the user.
Personally, I would prefer the 'tablegrid1_onclick' event to be restricted to the body of the tablegrid and not include the header (or footer) but it's not a deal-breaker and as you can see, there are ways to avoid it.
Hope that explains it,
Derek.