The On Exit database method cannot access records when executed on 4D Client. This is because the On Exit database method runs in a *local* process. As stated in the 4D documentation, a local process cannot access the data with 4D Client.
To access data under the context of exiting 4D Client do the following:
1. Create a global process from the exit code to perform the necessary data access.
2. Pause the exit code until the global process completes.
$a:=New process("MyOnExitMethod";256000;"MyOnExitMethod process";*)
DELAY PROCESS(Current process;10)
Where "MyOnExitMethod" will perform the data access as needed.