Fill combobox with vba RRS feed

  • Question

  • hi there, Ineed your help. I traying fill the combobox in Access form with languaje VBA, but i can't.

    Any ideas?

    This is my code.

    Private Sub fillShoptickets()

        MQuery.fillCombo Me!txtPartNum.Value 'this method is in Module
        For i = 0 To MQuery.rsCount
            Me!CmbShopTicket.AddItem MQuery.shopT(i)
        Next i
    End Sub

    in this part is the code Method

    Public Sub fillCombo(partNum As String)

        qry = "SELECT Shop_Ticket FROM t_Products WHERE Product_Number = '" & partNum & "'"
        Set db = CurrentDb
        Set rs = db.OpenRecordset(qry, dbOpenDynaset)
        ReDim shopT(rsCount)
        rsCount = rs.RecordCount
        If rs.NoMatch Then
            MsgBox "Not records Found!!!"
            i = 0
            While Not rs.EOF
                shopT(i) = rs.Fields(0).Value
                i = i + 1
        End If
    End Sub


    Thanks for your help.

    • Edited by Joel_Dev Wednesday, September 7, 2011 3:38 PM
    Wednesday, September 7, 2011 2:22 PM


  • Ok, I have the response. JAJAJA.

    My error was the properties of combobox, only change in data, row source type for value list.

    Anyway thanks for your help.

    • Marked as answer by Joel_Dev Wednesday, September 7, 2011 3:48 PM
    Wednesday, September 7, 2011 3:48 PM