I have a 3 columns in my MS access database namely ID, Name and Type. The Types are Driver, Conductor, and Inspector. I want is i click a button, all names in column "Name" that is classified as Driver will be the items of my combobox, also the other two. Thank you

Philippe.Lahaie commented: Show some work done -1

Recommended Answers

All 5 Replies

All your threads are about listviews and stuff, they are all very unclear and none show some work done.

Nobody should give you code until you provide proof that you have given this problem a genuine try.

You are not getting better, hell you get spoon fed answers and when you walk into an identical problem again, you come back asking for the same question.

Offtopic : why are you holding a #14 paper if your name is tenn?!

i don't know why #14

ijust tought it was funny, you did not have to remove your picture for that :/

but back on topic:

Give us some work done if you want help.

    Connect()
    SQL = "SELECT * FROM e2 WHERE t = '" & SearchSTR & "'" 
    Comm = New OleDbCommand(SQL, Conn)
    OleA = New OleDbDataAdapter(Comm)
    Datas.Clear()
    OleA.Fill(Datas, "e2")
    If Datas.Tables(0).Rows.Count > 0 Then
        drow = Datas.Tables(0).Rows(0)
        combobox1.items.add(drow("fn") --- fn is the column name in database

i change that code to this,

Private Function SearchRec() As Boolean
        Dim SearchSTR As String = "Driver"
        Dim RetVal As Boolean = False

        Connect()
        SQL = "SELECT * FROM e2 WHERE t = '" & SearchSTR & "'"
        Comm = New OleDbCommand(SQL, Conn)
        OleA = New OleDbDataAdapter(Comm)
        Datas.Clear()
        OleA.Fill(Datas, "e2")
        If Datas.Tables(0).Rows.Count > 0 Then
            drow = Datas.Tables(0).Rows(0)
            cmbd1.Items.Add(drow("fn"))


            RetVal = True
        Else
            RetVal = False

        End If





        Return RetVal
    End Function

but the combobox1 is only getting the 1st row of the column "fn" in my ms access database. how will i fix it

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.