Taking you literally that you ahve a query datasheet as your subform, you need to do the open from the main form.
Add a button, using the wizard, to your main form(F1) which opens the second form(F2) and choose the option to find a matching record. Choose the correct matching field from F2 and any field from F1 (this will be changed later).
Complete the wizard.
Modify the code to provide the correct matching field on F2. The code should look something like this:
Private Sub Command29_Click()
On Error GoTo Err_Command29_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmProducts" ' form to be opened
' productid is on F2; productno is the matching field on the subform
stLinkCriteria = "[ProductID]=" &
Me!nameofsubformcontrol.Form!ProductNo
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Command29_Click:
Exit Sub
Err_Command29_Click:
MsgBox Err.Description
Resume Exit_Command29_Click
End Sub