By default will the forms that use the same table share the same foundset. So then you don’t have to care about loading the right record, just show the detail form and you’re done!
If your form shows a related foundset or if you loaded the records on there yourself, then the forms don’t share the same foundset. In that case you can use this code: