I have two related tables
Table 1 - MAIN Table 2 - Keyword
ID1 Primary Key ID1 Foreign Key
etc ID2 Primary Key
KeywordName (Text)
I have a form with a List Box - Multi Select - List3
The following is not working, I think the output from the list selction is okay, but query opens a parameter box every time?
I am trying to get a list of records from table one (Main) that contain the combination of words selected, e.g If one word is selected, then all records are displayed where single word is linked, if two words are selected then only records get displayed where both words are related etc etc.
Table 1 - MAIN Table 2 - Keyword
ID1 Primary Key ID1 Foreign Key
etc ID2 Primary Key
KeywordName (Text)
I have a form with a List Box - Multi Select - List3
The following is not working, I think the output from the list selction is okay, but query opens a parameter box every time?
I am trying to get a list of records from table one (Main) that contain the combination of words selected, e.g If one word is selected, then all records are displayed where single word is linked, if two words are selected then only records get displayed where both words are related etc etc.
Code:
strList1 = ""
For Each item In Me.List3.ItemsSelected
strList1 = strList1 & Me.List3.ItemData(item) & ","
Next item
MySql = "SELECT DISTINCT MAIN.*, KEYWORD.KeywordName, KEYWORD.ID1 FROM MAIN INNER JOIN KEYWORD ON MAIN.ID1 = KEYWORD.ID1"
MySql = MySql & " WHERE KEYWORD.KeywordName IN (" & Mid(strList1, 1) & ")"