Hey there folks -- Probably not a surprise question on this forum. I did try to search for this and came up with a few posts but did not find any solutions. Hopefully, I was also doing the correct way to search on this forum. If this is a post for the nth time on this issue, I apologize.
So, I have 2 blocks:
1. Control Block that contains the STUDENT_ID field (Database Item = 'N')
2. Database block that contains the STUDENT_ID field (Database Item = 'Y' and many other fields)
My goal is do an Execute_Query if User enters the Student ID and either presses TAB or places the MOUSE in the database block and display the record if it exists. As we know, a Go_Block is not allowed in When-Validate-Item. So, I went one step further to "simulate" this. The problem is that I am still firing the Execute-Query when the record has already been retrieved. Here is what I have so far. So, the Key-Next-Item trigger works fine if User enters a Student ID and presses tab. It also works fine if User clicks on the STUDENT_BK as the When-New-Block-Instance trigger fires which in turn calls the Key-Next-Item. The problem occurs when after record has been retrieved and User clicks on control.student_id and then comes and clicks on the STUDENT_BK, the KEY-NEXT-ITEM trigger fires again.
Suggestions or pointers would be more than welcome.
Thanks!
CONTROL.student_id.Key-Next-Item
if :control.student_id is not null and :SYSTEM.BLOCK_STATUS != 'CHANGED' then
next_block;
clear_block(NO_COMMIT);
execute_query;
else
show_alert('Please enter Student ID');
end if;
STUDENT_BK.When-New-Block-Instance
go_item('control.student_id');
do_key('next_item');