Jump to content
Fórum Script Brasil
  • 0

Pesquisar no DataGrid


Almarante

Question

Olá Pessoal estou novamente precisando de ajuda.

Há alguns dias eu pediajuda para pesquisar no DataGrid, tive ajuda e tá tudo funcionando bem

mas eu quero atraves de um DataCombo escolher por qual coluna pesquisar.

fiz da maneira abaixoe deu erro de sintaxe ( operador faltando)

Private Sub txtpesquisa1_Change()
X = Len(txtpesquisa1.text)
AdoClientes.ConnectionString = "Provider=Microsoft.jet.OLEDB.4.0;Data Source=" & stCaminhoBD
 Filtro = txtpesquisa1.text & "%"
AdoClientes.RecordSource = "select * from Clientes WHERE  & cboPesquisa &  Like  '" & Filtro & "'"
AdoClientes.Refresh
AdoClientes.Recordset.Filter = "Tipo = " & 1
Do While AdoClientes.Recordset.EOF = False

AdoClientes.Recordset.MoveNext
Loop

End Sub

De que forma devo fazer?

Edited by Almarante
Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

assim??

AdoClientes.RecordSource = "select * from Clientes WHERE  " & cboPesquisa.Text &  " Like  '" & Filtro & "'"
ou
AdoClientes.RecordSource = "select * from Clientes WHERE  " & cboPesquisa.List(cboPesquisa.ListIndex) &  " Like  '" & Filtro & "'"

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      652k
×
×
  • Create New...