Cancel Delete if there are records in another form that are related to the form I am trying to delete

Cancel Delete if there are records in another form that are related to the form I am trying to delete

I think this is simple.  Basically if someone tries to delete a PO that has a single or multiple time records associated with it I want it to cancel the delete.  I am not sure if I need to count and then create a condition off of that count for it to work?

For example, 

rec  =  Employee_Time  [ID == PS_Work_Order_Purchase_Order];
if (rec  !=  null)
{
    alert "There are Labor / Equipment / Material records in the database you cannot delete this PO / WO!!";
    cancel delete;
}