Return to Snippet

Revision: 19006
at October 14, 2009 10:16 by tanerliq


Initial Code
Public KeyRetroceso As Boolean


Private Sub TDESCRIPCION_BREVE_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = vbKeyBack Or KeyCode = vbKeyDelete Then
            ' ..si hay texto en el Textbox
            If Len(TDESCRIPCION_BREVE.Text) <> 0 Then
                KeyRetroceso = True
            End If
        End If
End Sub

Function Autocompletar_FlexGrid(TBox As Object, texto As String)
'buscar las coincidencias de las descripcion breves ya ingresadas al sistema _
si las carga en el textbox de pantalla
Dim i As Integer
Dim pos_SelStart As Integer
Dim rst As ADODB.Recordset
Set rst = New ADODB.Recordset
rst.Open "select descripcion_breve from ot where descripcion_breve like '" & texto & "%'", cnt, adOpenStatic
    If rst.EOF <> True Then
        If (KeyRetroceso Or Len(TBox.Text) = 0) Then
            KeyRetroceso = False
            Exit Function
        End If
            pos_SelStart = TBox.SelStart
            TBox.Text = rst!DESCRIPCION_BREVE
            TBox.SelStart = pos_SelStart
            TBox.SelLength = Len(rst!DESCRIPCION_BREVE) - pos_SelStart
    End If
rst.Close
End Function

Initial URL

                                

Initial Description

                                

Initial Title
Auto completar un textbox desde una BD

Initial Tags

                                

Initial Language
Visual Basic