Total a check box field

Total a check box field

I have a form called Register

It has a checkbox field called Events_Open and a Net_Amount field for the total.

The data for the checkbox field comes from a form called Events with field names of Event_Name and Event_Price.  Event_Name is a calculated field holding the value of a dropdown called Event_Product.

In the On User Input of the Events_Open field is the following code:

//Set the initial value of Net Amount
input.Net_Amount = 0;
//Fetch the amount for the selected items and calculate the Net Amount.
for each item in input.Events_Open
{
    selectedItem  =  Events [Event_Name == item];
    input.Net_Amount = (input.Net_Amount  +  selectedItem.Event_Price);
}

This is erroring out.  Says it can not perform function on null or 0 value amoung other errors.

What do I need to do?