Este fórum está sendo desativado

Depois de 9 anos, este fórum será desativado. Mas calma.... estamos migrando para uma comunidade no DISCORD. Junte-se a nós.

ENTRAR PARA DISCORD

Tópicos relacionados a códigos VBA, gravação de macros, etc.
  • Avatar do usuário
#63467
Boa noite.

Criei um formulário (form_pesquisa) de busca de clientes que, ao digitar em uma texbox, carrega o valor do banco de dados em uma listbox. No entanto, gostaria que os dados (nome e telefone) fossem todos carregados na list quando ativasse o formulário e na textbox eu pusse filtrar os resultados. Desde já agradeço a ajuda.
Você não está autorizado a ver ou baixar esse anexo.
#63468
Tenta assim:
Código: Selecionar todos
Private Sub TextBox_pesquisa_nome_Change()

    Dim linha  As Integer
    linha = 0
    Set tabela = Nothing
    Set tabela = banco.OpenRecordset("SELECT * from [Dados$] WHERE [Dados$].[Nome] LIKE '" & Me.TextBox_pesquisa_nome & "*'")
    
    Me.ListBox_pesquisa.Clear
    
    Do Until tabela.EOF
        Me.ListBox_pesquisa.AddItem
        Me.ListBox_pesquisa.List(linha, 0) = tabela.Fields(1).Value
        Me.ListBox_pesquisa.List(linha, 1) = tabela.Fields(3).Value
        Me.ListBox_pesquisa.List(linha, 2) = tabela.Fields(6).Value
        linha = linha + 1
        tabela.MoveNext
    Loop
End Sub
long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]

Estamos migrando para uma comunidade no Discord