I'm working on a database that will hold bacterial strain typing information.
I want to open a form, select from a drop-down the test method, say test1, test2, or test1 AND test2 to look for patients (bacterial strains) that have identical matching results. Test1 is a 12 digit code, and test 2 is a 15 digit code. I would like to show the groups of matching strains separate from each other and then assign a group ID.
I've been working away at this and have found something that sort of works. The code below will show a list of records that have matching test results for the 2 tests (MIRU12 and OctalCode). However I would like to show the matches set by set as I may have 100's of matches and need to identify each matching set separately. Does anyone know of a way to do this?
Thanks
Private Sub cmdSearch_Click()
Me.lstResult.RowSource = "SELECT ENTRYTABLE.KEY, ENTRYTABLE.FIRSTNAME, ENTRYTABLE.SURNAME, ENTRYTABLE.MIRU12, ENTRYTABLE.OCTALCODE, ENTRYTABLE.REGION_DESIGNATION, ENTRYTABLE.STRAIN FROM ENTRYTABLE WHERE (((ENTRYTABLE.OctalCode) In (SELECT [OctalCode] FROM [ENTRYTABLE] As Tmp GROUP BY [OctalCode],[MIRU12] HAVING Count(*)>1 And [MIRU12] = [ENTRYTABLE].[MIRU12])))ORDER BY ENTRYTABLE.MIRU12"
End Sub
I want to open a form, select from a drop-down the test method, say test1, test2, or test1 AND test2 to look for patients (bacterial strains) that have identical matching results. Test1 is a 12 digit code, and test 2 is a 15 digit code. I would like to show the groups of matching strains separate from each other and then assign a group ID.
I've been working away at this and have found something that sort of works. The code below will show a list of records that have matching test results for the 2 tests (MIRU12 and OctalCode). However I would like to show the matches set by set as I may have 100's of matches and need to identify each matching set separately. Does anyone know of a way to do this?
Thanks
Private Sub cmdSearch_Click()
Me.lstResult.RowSource = "SELECT ENTRYTABLE.KEY, ENTRYTABLE.FIRSTNAME, ENTRYTABLE.SURNAME, ENTRYTABLE.MIRU12, ENTRYTABLE.OCTALCODE, ENTRYTABLE.REGION_DESIGNATION, ENTRYTABLE.STRAIN FROM ENTRYTABLE WHERE (((ENTRYTABLE.OctalCode) In (SELECT [OctalCode] FROM [ENTRYTABLE] As Tmp GROUP BY [OctalCode],[MIRU12] HAVING Count(*)>1 And [MIRU12] = [ENTRYTABLE].[MIRU12])))ORDER BY ENTRYTABLE.MIRU12"
End Sub