VBA‎ > ‎

Update the row source of a combo box in a subform

If you have a subform with a combo box, and you want to change the row source of that combo box in VBA code, use the following:
Dim strSQL2 As String
strSQL2 = "SELECT tblCustomers.CustomerNumber, tblCustomers.CustomerName FROM tblCustomers " & _
        " WHERE tblCustomers.CorpAcctNum = '" & Me.cbCorpAcctNum & "' ORDER BY tblCustomers.CustomerNumber; "
Me!frmInputPriceChangeForACustomer_Detail!CustomerNumber.RowSource = strSQL2