Ir para conteúdo
Fórum Script Brasil

Rodrigo Delalana

Membros
  • Total de itens

    1
  • Registro em

  • Última visita

Sobre Rodrigo Delalana

Rodrigo Delalana's Achievements

0

Reputação

  1. Amigos, seguinte: Já tenho a rotina que carrega o BD no combobox e autocompleta o combobox, porém minha rotina não filtra os dados que aparecem no combobox quando digito, tipo clico abre todos os itens do BD e na hora que começo a digitar ele não vai filtrando o BD. segue abaixo os codigos que uso: Autocompletar: Option Explicit Private Const CB_FINDSTRING As Long = &H14C Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, _ ByVal wMsg As Long, _ ByVal wParam As Long, _ lParam As Any) As Long Public Function Combo_AutoCompletar(xCombo As ComboBox, ByVal xKeyAscii As Long, Optional ByVal xUpperCase As Boolean = True) As Long Dim lngFind As Long, intPos As Long, intLength As Long, tStr As String With xCombo If xKeyAscii = 8 Then If .SelStart = 0 Then Exit Function .SelStart = .SelStart - 1 .SelLength = Len(.Text) .SelText = vbNullString Else intPos = .SelStart tStr = .Text .SelText = (Chr$(xKeyAscii)) ' .SelText = IIf(xUpperCase, _ ' UCase$(Chr$(xKeyAscii)), _ ' LCase$(Chr$(xKeyAscii))) End If lngFind = SendMessage(.hwnd, CB_FINDSTRING, 0, ByVal .Text) If lngFind = -1 Then .Text = tStr .SelStart = intPos .SelLength = (Len(.Text) - intPos) Combo_AutoCompletar = xKeyAscii Else intPos = .SelStart intLength = Len(.List(lngFind)) - Len(.Text) .SelText = .SelText & Right$(.List(lngFind), intLength) .SelStart = intPos .SelLength = intLength End If End With End Function <<<<<>>>>>> Private Sub cmbcor_KeyPress(KeyAscii As Integer) KeyAscii = Combo_AutoCompletar(cmbcor, KeyAscii) End Sub <<<<>>>>>> CARREGA O BANCO DE DADOS NO COMBOBOX: Private Sub Form_Load() Set DB2 = OpenDatabase(App.Path & "\banco_produtos.mdb") Set CARGO = DB2.OpenRecordset("SELECT * FROM tabcor where cor") 'Enquanto não for o fim de arquivo adiciona o campo funcao ao combobox While Not CARGO.EOF cmbcor.AddItem CARGO!cor CARGO.MoveNext Wend End Sub <<<<<<>>>>>>>> ESPERO QUE POSSAM ME AJUDAR... VLW
×
×
  • Criar Novo...