Maximum Thanks to Graham R Search for The Code, I couldn't have done it without you! (See the original posting about this at Applying Subform Filter from the Main Form.
Caution: at this point, searching by this way does not allow approximate searches. That is, if you are searching for "Harrison" and type in "Harris," then "Harrison" won't come up using this method. The best way to do this is to make this apply the criteria to your RECORDSOURCE. This code here applies it as a FILTER. To apply it as a RECORDSOURCE, go here.
Assuming your search form is called "search_form," the form which pops up to show the results of your search is called "browse_form." Assume that you are searching based on a field called "packlist" which is entered in the "packlist_entered" field of the search form. Also, the "browse_form" has a text box called "StatusBox," a common setup that I do so that messages along the lines of "You Searched for last name 'Harrison' Results...." can show up.
The code to open this form and then apply the filter would be (the special code is in BOLD):
Dim stDocName As String Dim stLinkCriteria As String Dim StatusBox As String stDocName = "browse_form" DoCmd.OpenForm stDocName, , , stLinkCriteria Forms!browse_form.Form.Filter = "[packlist] = " & Forms!search_form!packlist_entered Forms!browse_form.FilterOn = True Forms![browse_form]!StatusBox = "You Searched for Packlist Number" _ & " " & [Forms]![search_form]![packlist_entered] _ & " " & ". Results...." |