In Form,
I have 2 fields on form
Name – it has lookup values to select, it shows all the records(2columsn – name, RegId) in table StudentDetails
RegID – value to this filed should populate automatically based on “name” selected in above field.
Problem is in my example I have 2 records with same name, If user select second name, then RegID should populate with value “1001”
First of all, the reference should be based on ID, not on Name, exactly because Name isn’t a unique identification of a record.
Then you can either either do an additional select to StudentDetails table to get the name, or you can implement a lookup form that will set more than one field (e.g. Lookup form returning more than one value).
Or you can forget about copying Name completely and simply add a join with StudentDetails table to get the name.