The following canSelChange event handler fires the form’s row-level validation method if the currently selected tab is 2, and the form’s rowset has been modified. If the validation fails, the new tab will not be selected. If the row is valid and the user has selected tab 1, some processing is performed on NoteBook page 1 before it is displayed.

function NOTEBOOK1_canSelChange(nNewSel)

   if this.curSel = 2 

      if form.rowset.modified 

         if NOT form.recValid( // If row is bad, don't allow tab selection to change 

            return false 

         endif 

         if nNewSel = 1 

            class::PreparePage() // Refresh some data on NoteBook page 1 

         endif 

      endif 

   endif 

return true