Referring to a Subform Recordset from Different Subform

M

Mike Thomas

I have a form named "Part"

It has 2 subforms
1. form name is "part_supplier"
name of subform control is "part_supplier_sub"

2. form name is "supplier"
name of subform control is "supplier_sub"

From a module in the "supplier_sub" control I am trying to reset the record
pointer in the "part_supplier_sub" control to the first record.

This works:
[Form_part_supplier].Recordset.movefirst

I would prefer to do something like:
Me.parent.part_supplier_sub.recordset.movefirst

eg I would rather refer to the subform control's name in the parent form.

Can it be done this way, and if so how?

(Access's rules for referring to objects drive me crazy - if anyone knows
where this is explained in straightforward terms please give me the
reference.)

Many thanks
Mike Thomas
 
J

Joshua A. Booker

Mike,

From Access Help:
<Snip>
To refer to a subform or subreport

Refer to the subform or subreport control on the form or report that
contains the subform or subreport, then use the Form or Report property of
the control to refer to the actual subform or subreport.

a.. Type the identifier for the form or report that contains the subform
or subreport, followed by the name of its subform or subreport control, the
.. (dot) operator, and the Form or Report property.
For example, the following identifier refers to the Orders Subform subform
on the Orders form:

Forms![Orders]![Orders Subform].Form

<SNIP>

So in your case try this:

Me.parent.part_supplier_sub.FORM.recordset.movefirst

HTH,
Josh
 
M

Mike Thomas

Many thanks for the help.

Mike Thomas

Mark Phillipson said:
Hi,

Try:
http://www.mvps.org/access/forms/frm0031.htm

HTH

--

Cheers
Mark

Free Access/Office Add-Ins at:
http://mphillipson.users.btopenworld.com/


Mike Thomas said:
I have a form named "Part"

It has 2 subforms
1. form name is "part_supplier"
name of subform control is "part_supplier_sub"

2. form name is "supplier"
name of subform control is "supplier_sub"

From a module in the "supplier_sub" control I am trying to reset the record
pointer in the "part_supplier_sub" control to the first record.

This works:
[Form_part_supplier].Recordset.movefirst

I would prefer to do something like:
Me.parent.part_supplier_sub.recordset.movefirst

eg I would rather refer to the subform control's name in the parent form.

Can it be done this way, and if so how?

(Access's rules for referring to objects drive me crazy - if anyone knows
where this is explained in straightforward terms please give me the
reference.)

Many thanks
Mike Thomas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top