I have a form with a subform. The main form has Customer, PONumber, and OrderDate fields. The subform contains ProductID, QtyOrdered, QtyProduced, and QtyRemaning fields.
I also have a third form that I want to open and filter when I double click the ProductID field in the subform. I've got the third form to filter by ProductID, but I now realize I need it to filter by BOTH PartNumber and PONumber. The PONumber field is in the main form. How can I do this?
Here is the code I have that filters by the PartNumber:
Private Sub ProductID_DblClick(Cancel As Integer)
On Error GoTo Err_ProductID_DblClick
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmProduction"
stLinkCriteria = "[ProductID]=" & "'" & Me![ProductID] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_ProductID_DblClick:
Exit Sub
Err_ProductID_DblClick:
MsgBox Err.Description
Resume Exit_ProductID_DblClick
End Sub
I'm new to code and figured out this much by analyzing the Northwind sample db.
I also have a third form that I want to open and filter when I double click the ProductID field in the subform. I've got the third form to filter by ProductID, but I now realize I need it to filter by BOTH PartNumber and PONumber. The PONumber field is in the main form. How can I do this?
Here is the code I have that filters by the PartNumber:
Private Sub ProductID_DblClick(Cancel As Integer)
On Error GoTo Err_ProductID_DblClick
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmProduction"
stLinkCriteria = "[ProductID]=" & "'" & Me![ProductID] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_ProductID_DblClick:
Exit Sub
Err_ProductID_DblClick:
MsgBox Err.Description
Resume Exit_ProductID_DblClick
End Sub
I'm new to code and figured out this much by analyzing the Northwind sample db.