How can i call the below function to populate my access form list control

前端 未结 1 801
一向
一向 2021-01-27 13:41

I need to populate the access form list box from a access table.

Below is the code which I copy-pasted on button click event:

Public Sub PopulateLBWithD         


        
相关标签:
1条回答
  • 2021-01-27 14:16

    That code is overly complex for what you're probably trying to do.

    Why not try to just set the control's row source and then requery.

    If you want to retain the parameterization, then pass in the SQL.

    Dim strSQL As String
    
    strSQL = "SELECT MyField FROM MyTable;"
    
    Me.lstMyListBox.RowSource = strSQL
    Me.lstMyListBox.Requery
    
    0 讨论(0)
提交回复
热议问题