+ Reply to Thread
Results 1 to 6 of 6

Textbox search input with part of text using jolly (*)

  1. #1
    Registered User
    Join Date
    07-03-2013
    Location
    Milan
    MS-Off Ver
    Excel 2010
    Posts
    24

    Textbox search input with part of text using jolly (*)

    Dear all,
    please if you can, i have a problem.. Enclosed you find a simply xls file has a field to search customer.
    I should get the customer's name also by inserting a part of the name, actually the system requires that i insert the totally and exactly customer's name.
    Is there a way to modify or add a part of code to get a solution?
    Thank you in advance for your usually courtesy..
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Textbox search input with part of text using jolly (*)

    let me give you a copy of address book.

    When you click in the first name or surname field and type and type two characters it populates the listbox with any names that match.

    If you keep typing it will narrow down the search.

    Clicking on an entry will open another list box and display the address.

    You can modify this so that the listboxes are invisible until needed so they don't take up space on your userform

    I would have edited and incorpoated the list box routines in your userform. But there is a language issue.
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    07-03-2013
    Location
    Milan
    MS-Off Ver
    Excel 2010
    Posts
    24

    Re: Textbox search input with part of text using jolly (*)

    Thank you very much, it could be the right solution!
    If you have other example, please post them...

  4. #4
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Textbox search input with part of text using jolly (*)

    They would blow you away.

    Come back when you have a specific requirement.

  5. #5
    Registered User
    Join Date
    07-03-2013
    Location
    Milan
    MS-Off Ver
    Excel 2010
    Posts
    24

    Re: Textbox search input with part of text using jolly (*)

    Anyway i post code, i've some difficulties to modify it, cause i'm beginner.
    If there's someone who could help me.
    Thank you very much!

    '================================
    '===== Search frame =====
    '================================
    Private Sub cmdIniziaRicerca_Click()

    Dim Ctrl As Control
    Dim lCampo As Long
    Dim lRif As Long
    Dim C As Range
    Dim Rng As Range
    Dim lUltRiga As Long

    lCampo = 0

    With Me


    With .frSelezionaCampo

    For Each Ctrl In .Controls
    If Ctrl.Value = True Then
    lCampo = Mid(Ctrl.Name, _
    4, Len(Ctrl.Name))

    End If
    Next

    End With

    If .txtRicerca <> "" And lCampo <> 0 Then

    lUltRiga = sh.Range( _
    "A" & Rows.Count).End(xlUp).Row
    Set Rng = sh.Range("A2:V" & lUltRiga)

    For Each C In Rng.Range( _
    CELLS(1, lCampo), _
    CELLS(lUltRiga, lCampo))
    If C.Value = .txtRicerca.Text Then
    lRif = 4 - lCampo
    .txtID.Value = sh.CELLS(C.Row, 1).Value
    .TxtCause.Value = sh.CELLS(C.Row, 2).Value
    .txtldv.Value = sh.CELLS(C.Row, 3).Value
    .txtInvoice.Value = sh.CELLS(C.Row, 4).Value

    .txtawb.Value = sh.CELLS(C.Row, 5).Value
    .TxtDatum.Value = sh.CELLS(C.Row, 6).Value
    .txtiva.Value = sh.CELLS(C.Row, 7).Value
    .Texdatappp.Value = sh.CELLS(C.Row, 8).Value
    .Txtdataprat.Value = sh.CELLS(C.Row, 9).Value
    .cbodebtor.Value = sh.CELLS(C.Row, 10).Value
    .cboanno.Value = sh.CELLS(C.Row, 12).Value
    .txtimporto.Value = sh.CELLS(C.Row, 11).Value
    .cbocontenuto.Value = sh.CELLS(C.Row, 13).Value
    .cbomercato.Value = sh.CELLS(C.Row, 14).Value
    .cbopartner.Value = sh.CELLS(C.Row, 15).Value

    .cbonazione.Value = sh.CELLS(C.Row, 16).Value
    .txtposizione.Value = sh.CELLS(C.Row, 17).Value
    .cbostatus.Value = sh.CELLS(C.Row, 18).Value
    .txtnote.Value = sh.CELLS(C.Row, 20).Value
    .cboliability.Value = sh.CELLS(C.Row, 19).Value
    .Txtstart.Value = sh.CELLS(C.Row, 21).Value
    .txtend.Value = sh.CELLS(C.Row, 22).Value

    lRigaAttiva = C.Row
    lRigaValoreTrovato = C.Row
    Exit For
    End If
    Next
    Else
    MsgBox "No data or field selected", _
    vbOKOnly, "Attention"
    End If

    End With
    With Me.txtiva
    .Value = Format(.Text, "00000000000")

    End With
    With Me.TxtDatum
    .Value = Format(.Text, "dd/mm/yyyy")
    End With

    With Me.txtimporto
    .Value = Format(.Text, "€ #,##0.00")
    End With

    Set Ctrl = Nothing
    Set C = Nothing
    Set Rng = Nothing

    End Sub

  6. #6
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Textbox search input with part of text using jolly (*)

    Try This.

    You need to clear all textboxes once listbox 2 is open and showing full details.

    Click on it to close it then press clear button

    I did not include the clear function into listbox click as I do not know how you will want to go from here.
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How to search a text inside the textbox
    By azid_miracle in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-04-2012, 08:20 AM
  2. Replies: 8
    Last Post: 03-13-2012, 01:04 PM
  3. Search Function Using Input Textbox
    By tommib in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 05-28-2009, 06:44 AM
  4. is userform textbox input by user default TEXT?
    By JohnSeito in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-01-2009, 07:46 AM
  5. Selecting part text in a textbox
    By vqthomf in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-15-2005, 10:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1