Form to Form Update - Fetch Records

Form to Form Update - Fetch Records

I have created two forms and have linked the two with the lookup field. I now need to pull records from "Form A" into "Form B" based on user input form "Form B".  I attempted to use the Fetch Record code below  from the instructions in  the Developers Guide but I keep getting errors.
CodeLookup   
(       
displayname  =  "Code Lookup"       
type  =  picklist       
values  =  Property_Agent_Detail.Code2       
sortorder  =  ascending       
tooltip  =  "Please Select Code"       
on user input       
{           
temp  =  Property_Agent_Detail  [Code2 == input.CodeLookup];           
input.Address1 = temp.Address;    
  
}   
)












 
What is the best way to pull and display records between forms based on user input?