Greetings,
I am attempting a Multi-Select List Mover so that the user can select from one list (lfmVocabulary) and move it to another (lfmVocabularyAssign) on a query (qryVocabularyDefinitions). I got help with the coding from another Forum, but I am running into a Compile Error: Method or data member not found. The debug highlights the .List in the code below. Can anyone help me find a solution to this coding error?
Code:
Private Sub cmdAdd_Click()
Dim in_clause As String: in_clause = ""
Dim strSQL As String, i As Integer
' ITERATE TO BUILD COMMA-SEPARATED LIST FOR SQL IN() CLAUSE
With Me.lfmVocabulary
For n = 0 To .ListCount - 1
If .Selected(n) = True Then
' ASSUMING STRING VALUES HENCE SINGLE QUOTE ENCLOSURE
in_clause = in_clause & "'" & .List(n).Value & "', "
End If
Next n
End With
' REMOVE LAST COMMA AND SPACE
in_clause = Left(in_clause, Len(in_clause) - 2)
strSQL = "SELECT * FROM qryVocabularyDefinitions" _
& " WHERE some_column IN (" & in_clause & ")"
Me.lfmVocabularyAssign.RowSource = strSQL
Me.lfmVocabularyAssign.RowSourceType = "Table/Query"
Me.lfmVocabularyAssign.Requery
End Sub
Private Sub Form_Load()
Me.lfmVocabulary.RowSource = "qryVocabularyDefinitions"
Me.lfmVocabulary.RowSourceType = "Table/Query"
Me.lfmVocabulary.Requery
End Sub