I have a subform that I'm trying to filter via the selection on a combo box from another form. My current problem is that the main form opens, displays all of the records on the main form and if the subfom doesn't meet the criteria its blank. How do I display only the records where the subform meets the criteria?
Here's my current code:
Dim stDocName, strSQL As String
Dim stLinkCriteria As String
stDocName = "frmDataEntry"
DoCmd.OpenForm stDocName, , , stLinkCriteria
strSQL = "SELECT * FROM tblPlan " _
& "WHERE NP = """ _
& Forms![frmMainSwitchboard]![cboNP] & """"
Forms![frmDataEntry].[frmDataEntry2].Form.RecordSource = strSQL
Forms![frmDataEntry].[frmDataEntry2].Form.Requery
Here's my current code:
Dim stDocName, strSQL As String
Dim stLinkCriteria As String
stDocName = "frmDataEntry"
DoCmd.OpenForm stDocName, , , stLinkCriteria
strSQL = "SELECT * FROM tblPlan " _
& "WHERE NP = """ _
& Forms![frmMainSwitchboard]![cboNP] & """"
Forms![frmDataEntry].[frmDataEntry2].Form.RecordSource = strSQL
Forms![frmDataEntry].[frmDataEntry2].Form.Requery