subform error

L

LJG

I have a form embedded within a main form. The main form has a button to
show me selected records after onClick. I am having a problem targeting the
form as it keeps failing on this line:

Set rst = Forms!frmImp_Process_Client_STATUS.RecordsetClone

The main form is frmNewClientSelect, with the subform
frmImp_Process_Client_STATUS

Can anyone advise how I should change this to fix this.

Many thanks
 
M

Marshall Barton

LJG said:
I have a form embedded within a main form. The main form has a button to
show me selected records after onClick. I am having a problem targeting the
form as it keeps failing on this line:

Set rst = Forms!frmImp_Process_Client_STATUS.RecordsetClone

The main form is frmNewClientSelect, with the subform
frmImp_Process_Client_STATUS


Three points. One, subforms are not open in their own right
so they are not members of the Forms collection. You can
only get to a form object displayed in a subform control by
going through the subform control.

Two, newer versions of Access require you to use the Form
property of the subform control to get from the subform
control to the displayed form object.

Set rst=Me.frmImp_Process_Client_STATUS.Form.RecordsetClone

Three, the name in the above reference must be the name of
the subform control. The subform control's name can be
different from the name of displayed form object.
 
Top