Henry Olive 5 Posted yesterday at 05:23 AM Good Day I have a DBGrid and it has some datas which they come from another table I don't want the user to INSERT a new record, user can just edit available datas My Code in DBGrid1KeyDown is : if (Key=VK_DOWN) then if MyTable.RecNo = MyTable.RecordCount then Abort; it works, but i'd like to be sure if the logic here is good or there is a better way Thank You Share this post Link to post
Serge_G 87 Posted yesterday at 07:21 AM Hi, What about using onBeforeInsert event and put in it procedure TForm1.MyTableBeforeInsert(DataSet: TDataSet); begin Dataset.Cancel; end; Quote MyTable.RecNo = MyTable.RecordCount I am not fan of these two values Share this post Link to post
Stano 143 Posted yesterday at 01:55 PM If I understood correctly, it would be better/easier to hide the corresponding button in DBNavigator. Share this post Link to post
Uwe Raabe 2064 Posted 23 hours ago 16 minutes ago, Stano said: hide the corresponding button in DBNavigator That won't catch the keys pressed inside the grid itself. The BeforeInsert event is indeed the best place. Share this post Link to post