Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Parent reference

0 views
Skip to first unread message

MarianneZ

unread,
Dec 23, 2008, 3:01:14 PM12/23/08
to
I've addressed this question in the reports group, but I have a more general
question.

The ID field in my database uniquely identies a customer. For different
applications in my database I want to the user to supply the info to
determine the ID, either an ID or a last name or a last name and first name.
So I've created a generic form that will determine the ID. I will then use
that ID to populate a report or a form.

My idea was to pass the ID value by storing it in the parent form or report
in a consistently-named unbound field as follows:

Parent!ttxtID.Text = Me!txtCustID.Text

This code would appear in a procedure for the subform.

I've tried this, popping up the subform from a Report_Open and a Report_Load
procedure. It doesn't work. In the debugger inside the subform's code I look
at the local expressions and Me's parent is never properly defined. Plus I
get Run-time error 2185, which says I can't reference a property or a method
for a control unless the control has focus.

This seems to me a common use for a subform. There must be a way of passing
data.

Marshall Barton

unread,
Dec 23, 2008, 6:38:55 PM12/23/08
to
MarianneZ wrote:


Not sure I understand what you mean by your description of
the forms invilved. The following applies to a subform in a
main form or a subreport in a main report.

THe concept is fine, but you can not use the .Text property
for this. Use the .Value property instead:

Parent!ttxtID = Me!txtCustID

Note that subforms are initiated before the main form so the
main form may not be ready in the subform's Load event. The
Open event is way too early in either a form or report.
Note that I don't use A2007 enough to understand it, but I
don't see how a report's Load event can be of use.

--
Marsh
MVP [MS Access]

0 new messages