Hi!
I need help for my program..
I add a search the Adodc in my program with a combo box category,
but when i run the program and search...
the category "ID" not searching..

this is my codes

Private Sub Command1_Click()
If Text1.Text = "" Then
MsgBox "Type To Search"
    Else
    If Combo1.Text = "ID" Then
    Form2.Adodc1.Recordset.Filter = "ID='" & Text1.Text & "'"
    Else
    If Combo1.Text = "Surname" Then
    Form2.Adodc1.Recordset.Filter = "Surname='" & Text1.Text & "'"
    Else
    If Combo1.Text = "First Name" Then
    Form2.Adodc1.Recordset.Filter = "FirstName='" & Text1.Text & "'"
    Else
    If Combo1.Text = "Middle Name" Then
    Form2.Adodc1.Recordset.Filter = "MiddleName='" & Text1.Text & "'"
    End If
    End If
    End If
End If
End If

what should i do..
i need help urgent..

thanks..

I need help for my program..
I add a search the Adodc in my program with a combo box category,
but when i run the program and search...
the category "ID" not searching..

You said that category ID is not searching. How about another category?
If other category is successful to search then make sure that your column named "ID" is exist in your table.
But if ID is exist, you may see your input text to search.
Since you used '=' operator to compare input text, you must input right value (i mean same with value that store in your table).

Your code looks so crowded, so i modified a little with select-case :

Private Sub Command1_Click()
If Text1.Text = "" Then
    MsgBox "Type To Search"
Else
   Select Case Combo1.Text
        Case "ID"
            Form2.Adodc1.Recordset.Filter = "ID='" & Text1.Text & "'"
        Case "Surname"
            Adodc1.Recordset.Filter = "Surname='" & Text1.Text & "'"
        Case "First Name"
            Adodc1.Recordset.Filter = "FirstName='" & Text1.Text & "'"
        Case "Middle Name"
            Adodc1.Recordset.Filter = "MiddleName='" & Text1.Text & "'"
    End Select
End If
End Sub

Hi!
thanks for your replay, but nothing happen the "ID" not searching but the other is OK..

What kind of database you're using?
Can you post it here?

what did you mean? the file?

Yes. Database file.
What kind of database you're using in this program? access?

the format of my database is 2003..
then..

Okay Access database.
It seems that you don't want to post your database here.
Then i just can tell you to check your input in text box searching.
Like i said before, you must input same data as recorded in database. Uppercase, lowercase, all letters must be same. If your input didn't same as saved in database then program cannot search it.

sorry, because, before i don't know how to attach a file then .. i explorer it
now i know

but when i upload it,
i got a error..

i upload it now..

Okay. I made a simply vb project test and it's working.
Also i modified Middle Name searching with "Like" statment. It more usefull in searching.
Just change adodc connection string with your own path.

Hope it helps.

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.