if !mdown() and lastkey() = 145 ; and !(.lValidate and !evaluate(.cValidation)) * Change above line to if !mdown() and lastkey() = 145 ; and reccount(.recordsource) < 20 ; and !(.lValidate and !evaluate(.cValidation))Note: I directly used reccount() here but with deleted records this might not be what you want. In that case there are many ways just to get nondeleted count but an easy one would be to add a property to this grid's form - say GridReccount. With a property like this then above code would be :
if !mdown() and lastkey() = 145 ; and thisform.GridReccount < 20 ; and !(.lValidate and !evaluate(.cValidation)) thisform.GridReccount = thisform.GridReccount + 1On any delete operation you'd decrement that property.
*Delete button click code - Caption \<Delete with thisform.myEditGrid Delete In (.RecordSource) Go Recno() .setfocus() * If implemented GridReccount thisform.GridReccount = thisform.GridReccount - 1 endwithPS: 'set deleted on' to have record removed from grid. Also pay attention if class would do the update (lTableUpdate property) or you manually.