Results 1 to 3 of 3

Thread: add text to list box from text box

  1. #1
    Join Date
    May 2003
    Posts
    5

    Arrow add text to list box from text box

    hi

    ok i have a new question. it should be easy, im just blanking out. heres the situation.

    i have a text box... text22
    i have a list box... list33
    i typed "p" in text22

    how can i copy the "p" from text22 to list33 without hitting enter or an OK button?

    in other words, does text22 have a command such as GotFocus so that when text is entered into text22 it is displayed in the list box after each keystroke?

    i saw change, keydown, keypress, and some others. if one of those is it, how does it work? how do i use it? whats the syntax?


    thanks

    -paul

  2. #2
    Join Date
    May 2003
    Posts
    5
    ok im gonna start answering my own questions now:

    first adding any old text to a listbox is a Visual Basic feature. in ACCESS its not so easy.

    btw the code (in VB) is simple --list33.additem text22.text
    also, i used the Change event on the textbox; change is executed when something happens to the textbox, ie. text was entered. so you dont have to hit enter, it just happens. there are examples of making text "autocaps". you type lowercase or whatever and it makes it auto UPPERCASE. nice right?

    ok, so my whole thing here is i wanna create my own "AutoExpand".

    i bound my listbox to my table with all my customers. so when i run the form the listbox is populated with customers. i could scroll down and select myself if i wanted to.

    i want my custs' to log in (without scrolling), so they type "S" and then the listbox clears and only displays the S's. then "sa" then it clears and displays all the sa's. and so forth.

    so now im looking on how to make a search in the listbox, with the textbox value as the critiera. cool right?

    help!!! haha

    -paul

  3. #3
    Join Date
    Jan 2003
    Location
    UK
    Posts
    277
    ok im gonna start answering my own questions now:
    first sign of madness!!


    create a query of your customer table with all the necessary fields in it.

    in the customer name criteria part put.....

    Like Forms!FormName!TextboxName & "*"

    in the afterupdate event of your textbox put something like....

    ListBoxName.RowSource = "QueryName"

Posting Permissions

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