Referencing different table field from lookup field

Referencing different table field from lookup field

Hi there.  I am loving zoho creator but have a question.

I have a simple form called 'task' used to input some data.  One field called 'employee_name' is used as a 'lookup' field to select an employee from another 'form' containing employees and some of their info (phone number and email).  Within the 'task' form I would then like to store the employee's email address in order to send him a message 'on add' or 'on update'.

I would reference the 'employee_email' field using the same primary key that references 'employee_name'.  However, in zoho, this stuff is behind the scenes somewhere. 

I need some code something like:

my_recordset = open("select * from employee_table where employee_name = '" & input.employee "'");
my_recordset.movefirst;
set input.employee_email = my_recordset("employee_email")

Then I may hide the field 'employee_email' and use it to send the selected employee an email re the task.

Regards,

David