Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2003

    Unanswered: Help searching subforms

    I would like to build a separate form that accepts criteria to search fields in a form's subform. When you press search the main form is pulled showing all records that contain the subform information searched for.

    I am able to do this for fields that are part of the main form but I have been unable to pull up records when I search for subform field data. I can't seem to pull the data that is related on the main form.

    It would seem to me I would be able to search the subform by setting the link criteria to:

    "Forms![frmMainForm]![frmSubForm].Form![subFormFieldIWantToSearch] = " & Me![UserEntryDataFromSearchPage]

    but when I try to open the form by

    DoCmd.OpenForm stDocName, , , stLinkCriteria

    it pulls up no records (when I am certain there are results to be found).
    Can anyone help with this?

    much thanks,
    James Elmer
    Clinical Programmer Analyst
    Wellstat Biologics Corporation
    800.227.0582 x3338

  2. #2
    Join Date
    Jan 2003

    I think your approach may be problematic with a subform. But as in all things Access, there will be other means.

    First, I hope your subform is not linked to its parent form (the Link Child/Master Properties should be clear). Then open the SQL statement/Query used for the subform's recordsource and set the field's criteria to the seperate form (Forms!YourSeperateForm!ControlName). Then you can requery the subform from the sperate form and refresh its recordset.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts