Based on the Help for OnRowChanging, I believe it is possible to cancel a row navigation by returning true. However, I am having some trouble with this. When I test, it appears as though a new row is created and the focus leaves the grid. When I try to navigate back to the grid by clicking on a cell I get a COM object method invocation error (Error: 4399).
Do you have to do anything other than function_return true to stop row navigation when using OnRowChanging?
See below for my OnRowChanging attempt. A few additional notes. In this specific application, I am limited to non-data-aware grids. I use a property to detect if any changes are made and on the row change, call another function that will save the data. I am trying to add error handling so that if an error occurs, I would send an error message and cancel row navigation.
Any help would be greatly appreciated.Code:Function OnRowChanging Integer iCurrentSelectedRow Integer iNewRow Returns Boolean Boolean bRetVal bSaveRow String sSaveStat Forward Get OnRowChanging iCurrentSelectedRow iNewRow to bRetVal Get pbRowSaveStat to bSaveRow If (bSaveRow) Begin Get UpdateData iCurrentSelectedRow iNewRow to sSaveStat If (sSaveStat <> "OK") Begin Send UserError sSaveStat "Error" Function_Return True End End Set pbRowSaveStat to False Function_Return bRetVal End_Function
Thanks in advance,
Dan