Results 1 to 4 of 4
  1. #1
    jason73503 is offline Novice
    Windows 10 Access 2016
    Join Date
    Jun 2017
    Posts
    2

    Mutli-Select List Mover Compile error: Method or data member not found


    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

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Try

    .ItemData(n)
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    jason73503 is offline Novice
    Windows 10 Access 2016
    Join Date
    Jun 2017
    Posts
    2
    Thanks @pBaldy,

    I've replaced the .List with .ItemData(n) and modified the code a little to suit the new input.

    The problem now is I get an "Enter Parameter" msg box for the some_column bit. The code is as follows:

    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 & "'" & .ItemData(n) & "', "
           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

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    That needs to be replaced by the name of the field in your table that you want the criteria applied to.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. compile error Method or data member not found
    By gunterbrink in forum Programming
    Replies: 9
    Last Post: 01-23-2017, 09:45 AM
  2. Replies: 3
    Last Post: 12-24-2016, 12:42 PM
  3. Compile Error: Method or data member not found
    By JustinC in forum Programming
    Replies: 4
    Last Post: 11-18-2014, 10:25 AM
  4. compile error method or data member not found???
    By chuman vishal in forum Programming
    Replies: 2
    Last Post: 02-26-2013, 01:57 PM
  5. Compile Error: Method or data member not found
    By subtilty in forum Programming
    Replies: 5
    Last Post: 02-09-2012, 07:56 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums