Using Record ID to fetch data - Is there an issue?

Using Record ID to fetch data - Is there an issue?

I am trying to fetch data from a table using the record ID.  Is there a problem with this?
The script below is On Load script in a form..
The first 2 lines successfully find the record number from a form and populate the Record_ID field.
The last 2 lines are supposed to use the record ID to fetch the customer name (CustName) but Test_Field remains blank. 
I have checked that the Record_ID is valid.  It was generated from another script.  I can't see why this doesn't work.
 
 
EditData = Record_ID_temp[Key_Code == "A"] ); 
Record_ID = EditData.ID ; 
CustName = Customer_Contacts[ID == EditData.ID].Customer ; 
Test_Field = CustName ; 
 
Thanks in advance for any help....