Tracked it down for now. I have a variable storing a sort index (0,1 or 2). It is correct after I search a name which is supposed to establish the the order. It does. When I execute the code to get the next record the sort index is 0 while for lastname it was 1 before entering the sub for navigating. The $sortIndex
$sortindex is declared here:
use vars qw($dataupdatemessage $dataupdatefilemessage $LoggedOnId $sortindex );
It should persist. Searched all instances and see nothing that would change it.