[AccessD] FW: Search a subform from a parent form

Heenan, Lambert Lambert.Heenan at aig.com
Fri Mar 15 11:42:06 CDT 2013


Forwarding to the list (now that I've re-subscribed) for completeness.

Lambert

From: Arthur Fuller [mailto:fuller.artful at gmail.com]<mailto:[mailto:fuller.artful at gmail.com]>
Sent: Friday, March 15, 2013 11:35 AM
To: Heenan, Lambert
Subject: Re: [AccessD] Search a subform from a parent form

That worked like a charm, Lambert. Thanks! The app I'm working on needs this capability in several places

A.

On Fri, Mar 15, 2013 at 10:10 AM, Arthur Fuller <fuller.artful at gmail.com<mailto:fuller.artful at gmail.com>> wrote:
Thanks, Lambert. I'll try that right now, but just glancing at your code, my feeling is that this looks right -- and also, nice and clean. I like it.

A.

On Fri, Mar 15, 2013 at 10:01 AM, Heenan, Lambert <Lambert.Heenan at aig.com<mailto:Lambert.Heenan at aig.com>> wrote:
Not sure if my new email address is registered yet, so I'll reply direct as well as to the list.

I do this kind of search (for records in a sub-form) from the parent form without the need of any public functions in the subform(which can potentially be called from places other than where you intended).

In the parent form I build the criteria that will be needed to search in the sub-form records and then I do that search like this...

        strCriteria = "SomeField=" & nSomeValue
                With Me!SubFormControl.Form.RecordsetClone
                .FindFirst strCriteria
                If Not .NoMatch Then
                Me SubFormControl.Form.Bookmark = .Bookmark
                End If
        End With

HTH
Lambert

-----Original Message-----
From: accessd-bounces at databaseadvisors.com<mailto:accessd-bounces at databaseadvisors.com> [mailto:accessd-bounces at databaseadvisors.com<mailto:accessd-bounces at databaseadvisors.com>] On Behalf Of Arthur Fuller
Sent: Friday, March 15, 2013 12:43 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Search a subform from a parent form

Ah, Charlotte. My syntax guess was right. Thanks for confirming.

Interesting.... I'm not out of the words quite yet. I single-step from the combo to the sub inside the child form, where the wiz-generated code says:

<vba>
    ? there's a parameter called intTarget...
    DoCmd.SearchForRecord , "", acFirst, "[ID] = " & intTarget </vba>

This gives me the error message: The action or method is invalid because the form or report isn't bound to a table or query.

But it is:
? Me.RecordSource
vCustomers ' a View



On Thu, Mar 14, 2013 at 9:36 PM, Charlotte Foust
<charlotte.foust at gmail.com<mailto:charlotte.foust at gmail.com>>wrote:

> Try Me.subformname.form.ProcName
>
> Charlotte
>
> On Thu, Mar 14, 2013 at 6:32 PM, Arthur Fuller
> <fuller.artful at gmail.com<mailto:fuller.artful at gmail.com>
> >wrote:
>
> > The combo box wizard lets you build a "finder" very easily. I want
> > one of those, only I want it located on this form's parent. In other
> > words, even though the finder is on the parent, I want it to search the subform.
> >
> > There's code in the subform to accept an argument and do the search.
> > I've declared  that procedure public. What is the syntax for calling
> > that procedure from the parent? Call SubformName.ProcName(arg)? Am I close?
> >
> > TIA,
> > --
> > Arthur
> > --
> > AccessD mailing list
> > AccessD at databaseadvisors.com<mailto:AccessD at databaseadvisors.com>
> > http://databaseadvisors.com/mailman/listinfo/accessd
> > Website: http://www.databaseadvisors.com
> >
> --
> AccessD mailing list
> AccessD at databaseadvisors.com<mailto:AccessD at databaseadvisors.com>
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>



--
Arthur
Cell: 647.710.1314<tel:647.710.1314>

Prediction is difficult, especially of the future.
  -- Niels Bohr
--
AccessD mailing list
AccessD at databaseadvisors.com<mailto:AccessD at databaseadvisors.com>
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



--
Arthur
Cell: 647.710.1314<tel:647.710.1314>

Prediction is difficult, especially of the future.
  -- Niels Bohr




--
Arthur
Cell: 647.710.1314

Prediction is difficult, especially of the future.
  -- Niels Bohr



More information about the AccessD mailing list