derek wrote:Hi Adam,
For me, the easiest way would be to use a calculated field and avoid doing it in the script.
(select round(avg(rating),2) from item where item.id_school = school.id)
See attached.
Derek.
Sample project on the post above.
I realized that, when deleting a school on schools grid, items belonging to school on items grid get deleted too. I have no idea how to do this but I like add some safety to prevent such deletes:
When school grid delete button clicked, check to see if there is any records listed in item grid belonging to the record user trying to delete. If there is then delete canceled with custom message "Cannot delete........ etc"
edit:
-----------------
tried the following but didn't work fully:
procedure Form1_btnSchoolDELETE_OnClick (Sender: string; var Cancel: boolean);
begin
if Form1.tgItem.RowCount > - 1 then
begin
Cancel := true;
MessageBox ('Reord you are trying to delete contains sub records. You must delete sub record/s first.','Error',MB_OK+MB_ICONERROR);
end;
end;
couldn't clear cancel:=true so that user can delete main record after clearing sub records.
Adam
God... please help me become the person my dog thinks I am.