Get current subform record form main form

I have a main form (card form) and a subform(list form) and in the code behind the main form I am trying to find out which record in the subform has been selected. Say for instance I need to get the primary key of the record selected on the subform when the user clicks a button on the main form and then use this to do some further processing I have tried using the currform.subformcontrol.FORM to get a handle on the sub form but this does not seem to work. There must be a simple way to to do this but I can’t see it. Advice would be appriciated.

define a procedure RecGet in the subform with var-parameters of the tabletype used by the subform. THis procedure can be called by the mainform similar to currform.subformcontrol.FORM.RecGet(param)

Hello Debbi, Try out this… CurrForm.subformcontrol.FORM.GETRECORD(RecVariable); RecVariable will hold the current record from subform. Regards, Rajesh S.

Thank you for your answers. Both creating a function in the subform to return the rec.“No.” and using CurrForm.SubformControl.FORM.GETRECORD work great.