To specify a table, you first have to go to a layout that specifies a Table Occurrence in "show records from" in that Layout's Layout Setup... dialog.
Here's an outline of the script:
Set Variable [$StudentID ; Value: Students::StudentID ]
Go To Layout [StudentDetails (StudentDetails)]
Set Field [StudentDetails::StudentID ; $StudentID]
Go To Layout [Original Layout]
Note that this script will always create a related record when you click its button. If you want to strictly limit your system to just one such related record, you might want to add code that first checks for to see if such a record exists before creating a new one.
Thank you that works