TEXBOX AUTOCOMPLETE
[ô]no Change
Private Sub txtPesquisaNome_Change()
Dim bcoUsuario As New ADODB.Recordset
Dim Pos As Integer
CarregarUsuario Me.txtPesquisaNome.Text
If txtPesquisaNome.SelStart = 0 Then Exit Sub
On Error Resume Next
Set bcoUsuario = cnSQL.Execute([Ô]select top 1 usu_005 from [usuario] where usu_006=[ô]não[ô] and usu_005 like [ô][Ô] & Mid(Me.txtPesquisaNome.Text, 1, Me.txtPesquisaNome.SelStart) & [Ô]%[ô] order by usu_005 asc[Ô])
Pos = txtPesquisaNome.SelStart
If (Not bcoUsuario.EOF) And (Not bcoUsuario.BOF) Then
Me.txtPesquisaNome.Text = UCase(bcoUsuario.Fields([Ô]usu_005[Ô]))
Me.txtPesquisaNome.SelStart = Pos
Me.txtPesquisaNome.SelLength = Len(Me.txtPesquisaNome.Text)
End If
If bcoUsuario.State = adStateOpen Then bcoUsuario.Close
Set bcoUsuario = Nothing
End Sub
no KeyAscci
Private Sub txtPesquisaNome_KeyPress(KeyAscii As Integer)
On Error Resume Next
If KeyAscii = vbKeyReturn Then [ô]Enter
CarregarUsuario Me.txtPesquisaNome.Text
Me.txtDataInicial.SetFocus
End If
End Sub
Ou
Private Sub txtPesquisaNome_KeyDown(KeyCode As Integer, Shift As Integer)
On Error Resume Next
If KeyCode = vbKeyReturn Then [ô]Enter
CarregarUsuario Me.txtPesquisaNome.Text
Me.txtDataInicial.SetFocus
End If
End Sub
Private Sub txtPesquisaNome_Change()
Dim bcoUsuario As New ADODB.Recordset
Dim Pos As Integer
CarregarUsuario Me.txtPesquisaNome.Text
If txtPesquisaNome.SelStart = 0 Then Exit Sub
On Error Resume Next
Set bcoUsuario = cnSQL.Execute([Ô]select top 1 usu_005 from [usuario] where usu_006=[ô]não[ô] and usu_005 like [ô][Ô] & Mid(Me.txtPesquisaNome.Text, 1, Me.txtPesquisaNome.SelStart) & [Ô]%[ô] order by usu_005 asc[Ô])
Pos = txtPesquisaNome.SelStart
If (Not bcoUsuario.EOF) And (Not bcoUsuario.BOF) Then
Me.txtPesquisaNome.Text = UCase(bcoUsuario.Fields([Ô]usu_005[Ô]))
Me.txtPesquisaNome.SelStart = Pos
Me.txtPesquisaNome.SelLength = Len(Me.txtPesquisaNome.Text)
End If
If bcoUsuario.State = adStateOpen Then bcoUsuario.Close
Set bcoUsuario = Nothing
End Sub
no KeyAscci
Private Sub txtPesquisaNome_KeyPress(KeyAscii As Integer)
On Error Resume Next
If KeyAscii = vbKeyReturn Then [ô]Enter
CarregarUsuario Me.txtPesquisaNome.Text
Me.txtDataInicial.SetFocus
End If
End Sub
Ou
Private Sub txtPesquisaNome_KeyDown(KeyCode As Integer, Shift As Integer)
On Error Resume Next
If KeyCode = vbKeyReturn Then [ô]Enter
CarregarUsuario Me.txtPesquisaNome.Text
Me.txtDataInicial.SetFocus
End If
End Sub
dar uma olhada neste mini projeto, so que tem que registra [Ô]CTEXTBOX[Ô] e [Ô]PRJEVICOLLECTIONCONTROL[Ô] eu gosto muito deles nos meus projeto, este mini projeto ele esta no meu projeto so tirei ele pra vc estudar.
a vez q precisei usei o exemplo do site do macoratti sem problema.....
Tópico encerrado , respostas não são mais permitidas