Results 1 to 6 of 6

Thread: ATTN: Auto-completing Textbox

  1. #1

    Thread Starter
    Hyperactive Member Gimpster's Avatar
    Join Date
    Oct 1999
    Location
    Redmond, WA 98052
    Posts
    331

    Post

    I have a form with several text boxes that are populated through code from a database. This form is accessing a customer table that I have set up on the database. What I want to be able to do, is have the text box autocomplete the customer's name as you type it. Meaning that it would have to sort the names in the database and be able to run through them as you type. Aaron Young gave me some code that would do something similar with a text box and a list box. I suppose I could do the same thing, but I think that would slow it way down, if I took the time to first read every customer off the table and then populate a listbox. Is there any other way to do it? I have the names broken down into:

    • Company Name
    • Last Name
    • First Name
    • Middle Initial


    All four of these are separate columns in the table, and I need to be able to search them all. Thank you so much for your help.

    ------------------
    Ryan


    [This message has been edited by Gimpster (edited 01-21-2000).]

  2. #2
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,175

    Post

    You could do an SQL Like but that would probably be too slow. I don't know what Aaron suggested, but his suggestions are rarely improved on.

    ------------------
    Marty
    Can you buy an entire chess set in a pawn shop?

  3. #3

    Thread Starter
    Hyperactive Member Gimpster's Avatar
    Join Date
    Oct 1999
    Location
    Redmond, WA 98052
    Posts
    331

    Post

    Hehehehe, very true Marty. Thanks for the advice, I guess I'll just have to list all the names in a text box, and go from there. Thanks again.

    ------------------
    Ryan

  4. #4
    Member
    Join Date
    Jan 1999
    Location
    Longmont,CO
    Posts
    53

    Post

    If you loaded up arrays with all company name, first name, last name, & middle initial possiblities at startup, you could then check thru each array element as you're typing much faster than requerying the database. Populate an array for each column of data. The only danger would be someone else adding/deleting a database entry while you're app is running. If this is not a problem then you'd see a big speed increase by populating arrays at Form_Load.

    Hope this helps,

    Dan

    [This message has been edited by mcleran (edited 01-23-2000).]

  5. #5
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844

    Post

    You could also use a disconnected recordset and use the recordset's SEEK/FIND methods to search thru your database, without affecting network traffic (if over a network). That is usually pretty fast and much more flexible than an array.

  6. #6

    Thread Starter
    Hyperactive Member Gimpster's Avatar
    Join Date
    Oct 1999
    Location
    Redmond, WA 98052
    Posts
    331

    Post

    Clunietp, what do you mean by a "disconnected recordset"? How would you do something like that?

    ------------------
    Ryan

Posting Permissions

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



Click Here to Expand Forum to Full Width