I'm trying to use a combo box on a form as the parameter to filter a form (frmDataEntry). The field that I want to filter is actually on a subform (subSpecimenData) and is called [Tissue Site]. The code runs but it doesn't filter the recordset based on the value of the combo box.
Any help will be greatly appreciated, Kopy
===================================
Private Sub cboTSUSite_AfterUpdate()
Dim stDocName, strSQL As String
Dim stLinkCriteria As String
stDocName = "frmDataEntry"
DoCmd.OpenForm stDocName, , , stLinkCriteria
strSQL = "SELECT tblPatients.*, tblTissueSamples.*"
strSQL = strSQL & "FROM tblPatients RIGHT JOIN tblTissueSamples ON tblPatients.[Pt MRN] = tblTissueSamples.[Pt MRN]"
strSQL = strSQL & " WHERE (((tblTissueSamples.[Tissue Site])=[forms]![frmLookUp]![cboTSUSite]));"
Forms![frmDataEntry].RecordSource = strSQL
Me.Requery
DoCmd.Maximize
End Sub
Any help will be greatly appreciated, Kopy
===================================
Private Sub cboTSUSite_AfterUpdate()
Dim stDocName, strSQL As String
Dim stLinkCriteria As String
stDocName = "frmDataEntry"
DoCmd.OpenForm stDocName, , , stLinkCriteria
strSQL = "SELECT tblPatients.*, tblTissueSamples.*"
strSQL = strSQL & "FROM tblPatients RIGHT JOIN tblTissueSamples ON tblPatients.[Pt MRN] = tblTissueSamples.[Pt MRN]"
strSQL = strSQL & " WHERE (((tblTissueSamples.[Tissue Site])=[forms]![frmLookUp]![cboTSUSite]));"
Forms![frmDataEntry].RecordSource = strSQL
Me.Requery
DoCmd.Maximize
End Sub