Adding values multiple columns to listbox in form access vba

前端 未结 5 1692
谎友^
谎友^ 2021-01-13 02:07

I have problem with adding values to multiple columns in listbox in access. I have tried solution like this: Adding items in a Listbox with multiple columns and this: vba li

5条回答
  •  悲&欢浪女
    2021-01-13 02:33

    Here is an example of adding items to a multi-column unbound list box on an access form if the row source is a value list. You have to add it by creating a string that you place in a value list.

    Private Sub cmdAddPosition_Click()
        Dim i As Integer
    
        Me.lstAddPositions.ColumnCount = 7
    
        If Me.txtAddPos.Value = i And i > 0 And i < 50 Then
             Me.lstAddPositions.AddItem "Col1" & "," & "col2" & "," & "Col3" & "," & _
             "Col4" & "," & "Col5" & "," & "col6" & "," & "col7"  &";"     
        End If
    
        Me.lstAddPositions.Requery
    End Sub
    

提交回复
热议问题