You might like to take a look at FindRecord.zip in my public databases folder at:
https://onedrive.live.com/?cid=44CC60D7FEA42912&id=44CC60D7FEA42912!169
If you have trouble downloading a specific file, clicking on the 'Download' button at the top of the page while no files are selected should download a zip file of all files in the folder, from which you should then be able to unpack the relevant file.
This little demo file incudes an option for filtering by a subform value, i.e. on the basis of a value in a row in a referencing table, in this case filtering the parent form to those projects for which one of the contacts is that selected in an unbound combo box in the parent form. The code for this is:
Private Sub cboLastname_AfterUpdate()
Const MESSAGETEXT = "No matching records found."
Dim ctrl As Control
Dim strFilter As String
Set ctrl = Me.ActiveControl
strFilter = "ProjectID IN(SELECT ProjectID " & _
"FROM ContactProjects WHERE ContactID = " & ctrl & ")"
If Nz(ctrl, 0) = 0 Then
' turn off filter
Me.FilterOn = False
Else
If Not IsNull(DLookup("ContactID", "ContactProjects", "ContactID = " & ctrl)) Then
' filter form to name selected in combo box
Me.Filter = strFilter
Me.FilterOn = True
Else
' inform user if no matching records found and show all records
MsgBox MESSAGETEXT, vbInformation, "Warning"
Me.FilterOn = False
Me.Requery
End If
End If
End Sub
In this case the Filter property of the parent form is set to the value of the strFilter variable. In your case you'd set the value of the WhereCondition argument of the OpenReport method to filter a report.