PDA

Click to See Complete Forum and Search --> : ATTN: Auto-completing Textbox


Gimpster
Jan 21st, 2000, 05:30 AM
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).]

MartinLiss
Jan 21st, 2000, 06:31 AM
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?

Gimpster
Jan 21st, 2000, 07:00 AM
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

mcleran
Jan 22nd, 2000, 09:29 PM
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).]

Clunietp
Jan 23rd, 2000, 03:39 AM
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.

Gimpster
Jan 24th, 2000, 07:07 AM
Clunietp, what do you mean by a "disconnected recordset"? How would you do something like that?

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