Pass record from table to another field

Hi
i have lookup in a field in my form that I choose (table has field1=“type of cheese” field2 “code of cheese” in my form I choose filed1 from lookup to var 1
and I want to pass field2 to a second field in my form without taping it
form
cheesetype—> lookup to a table and choose the right one
code cheese—> automatically get the code from a table without entering it
any help pls

I think you have a similar solution here: